Re: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if present

2023-03-22 Thread Subash Lakkimsetti
Hi Jiewen,

Bootloaders as SBL, coreboot supports multiple payloads and they would have TPM 
acpi tables populated at bootloader phase.
These tables gets populated in bootloaders well before the payload gets loaded. 
Its population cannot be avoided due to generic implementations.

Uninstallation from universal payload package need a separate module to handle 
this. 
It is dependent on gEfiAcpiTableProtocolGuid & gEfiAcpiSdtProtocolGuid which 
are populated from AcpiTableDxe.

We might need add a dependency in TCG2ACPI on this module. Otherwise TPM2tables 
published from TCG2ACPI can be installed as per the dispatch order.

In order to adapt the TCG drivers for UEFI payload, TCG2ACPI has to updated to 
support payload. We can either follow one of the methods,
*   Uninstall the TPM2 ACPI tables if they get published from bootloader 
phase. The current patch address it.
*   Another method, Modify the ACPI tables updated from bootloader as per 
the EDK2 requirements. This also has to be done in TCG2ACPI.

Regards,
Subash

-Original Message-
From: Yao, Jiewen  
Sent: Wednesday, March 22, 2023 6:43 AM
To: devel@edk2.groups.io; Lakkimsetti, Subash 
Cc: Zhang, Qi1 ; Kumar, Rahul R 
Subject: RE: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if 
present

Question: Why not uninstall it in the universal payload package? or even not 
populate it?


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Subash 
> Lakkimsetti
> Sent: Wednesday, March 22, 2023 1:59 PM
> To: devel@edk2.groups.io
> Cc: Lakkimsetti, Subash ; Zhang, Qi1 
> ; Kumar, Rahul R 
> Subject: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI 
> if present
> 
> From: Subash Lakkimsetti 
> 
> Bootloader supports multiple payload and TPM2 ACPI tables are updated 
> at bootloader phase. When UEFI is used payload these will be duplicates.
> The tables are to be uninstalled before updating the TCG2ACPI tables 
> to avoid duplicates.
> 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Signed-off-by: Subash Lakkimsetti 
> ---
>  SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c   | 251
> ++
>  SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf |   3 +
>  2 files changed, 254 insertions(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> index e8822cbeb0..4b35796ba7 100644
> --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> @@ -39,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  
> #include 
> 
>  #include 
> 
>  #include 
> 
> +#include 
> 
> +#include 
> 
> 
> 
>  //
> 
>  // Physical Presence Interface Version supported by Platform
> 
> @@ -867,6 +869,245 @@ PublishTpm2 (
>return Status;
> 
>  }
> 
> 
> 
> +/**
> 
> +  Uninstall TPM2 SSDT ACPI table
> 
> +
> 
> +  This performs uninstallation of TPM2 SSDT tables published by
> 
> +  bootloaders.
> 
> +
> 
> +  @retval   EFI_SUCCESS The TPM2 ACPI table is uninstalled successfully 
> if
> found.
> 
> +  @retval   Others  Operation error.
> 
> +
> 
> +**/
> 
> +EFI_STATUS
> 
> +UnInstallTpm2SSDTAcpiTables (
> 
> +  )
> 
> +{
> 
> +  UINTNTableIndex;
> 
> +  UINTNTableKey;
> 
> +  EFI_ACPI_TABLE_VERSION   TableVersion;
> 
> +  VOID *TableHeader;
> 
> +  EFI_STATUS   Status;
> 
> +  EFI_ACPI_SDT_PROTOCOL*mAcpiSdtProtocol;
> 
> +  EFI_ACPI_TABLE_PROTOCOL  *mAcpiTableProtocol;
> 
> +  CHAR8TableIdString[8];
> 
> +  UINT64   TableIdSignature;
> 
> +
> 
> +  //
> 
> +  // Determine whether there is a TPM2 SSDT already in the ACPI table.
> 
> +  //
> 
> +  Status = EFI_SUCCESS;
> 
> +  TableIndex = 0;
> 
> +  TableKey   = 0;
> 
> +  TableHeader= NULL;
> 
> +  mAcpiTableProtocol = NULL;
> 
> +  mAcpiSdtProtocol   = NULL;
> 
> +
> 
> +  //
> 
> +  // Locate the EFI_ACPI_TABLE_PROTOCOL.
> 
> +  //
> 
> +  Status = gBS->LocateProtocol (
> 
> +  ,
> 
> +  NULL,
> 
> +  (VOID **)
> 
> +  );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +DEBUG ((
> 
> +  DEBUG_INFO,
> 
> +  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Table
> Protocol \n "
> 
> +  ));
> 
> +return Status;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // Locate the EFI_ACPI_SDT_PROTOCOL.
> 
> +  //
> 
> +  Status = gBS->LocateProtocol (
> 
> +  ,
> 
> +  NULL,
> 
> +  (VOID **)
> 
> +  );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +DEBUG ((
> 
> +  DEBUG_INFO,
> 
> +  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Sdt 
> + Protocol,
> "
> 
> +  "\n"
> 
> +  ));
> 
> +return Status;
> 
> +  }
> 
> +
> 
> +  while (!EFI_ERROR (Status)) {
> 
> +Status = mAcpiSdtProtocol->GetAcpiTable (
> 
> + TableIndex,
> 
> + 

Re: [edk2-devel] [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload

2023-03-22 Thread Lu, James
Reviewed-by: James Lu 


Thanks,
James

-Original Message-
From: Liu, KasimX  
Sent: Thursday, March 16, 2023 3:01 PM
To: devel@edk2.groups.io
Cc: Liu, KasimX ; Dong, Guo ; Ni, Ray 
; Lu, James ; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload

From: KasimX Liu 

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

add '-pb' command of build bios with exist PreUniversalpayload file.
'-e'  command of olny build the Universalpayloadentry file.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: KasimX Liu 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 78 +
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..aad4f7f195 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -65,6 +65,8 @@ def BuildUniversalPayload(Args, MacroList):
 ObjCopyFlag= "elf32-i386"

 EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ElfToolChain), 
os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))

 

+if Args.PreBuildUplBinary is not None:

+EntryOutputDir = os.path.abspath(Args.PreBuildUplBinary)

 EntryModuleInf = 
os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")

 DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")

 DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv"))

@@ -95,18 +97,19 @@ def BuildUniversalPayload(Args, MacroList):
 #

 # Building DXE core and DXE drivers as DXEFV.

 #

-BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format (DscPath, 
BuildTarget, ToolChain, PayloadReportPath, Quiet)

-BuildPayload += Pcds

-BuildPayload += Defines

-RunCommand(BuildPayload)

+if Args.BuildEntryOnly == False:

+BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format 
(DscPath, BuildTarget, ToolChain, PayloadReportPath, Quiet)

+BuildPayload += Pcds

+BuildPayload += Defines

+RunCommand(BuildPayload)

 #

 # Building Universal Payload entry.

 #

-BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format 
(DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, 
ModuleReportPath, Quiet)

-BuildModule += Pcds

-BuildModule += Defines

-RunCommand(BuildModule)

-

+if Args.PreBuildUplBinary is None:

+BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format 
(DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, 
ModuleReportPath, Quiet)

+BuildModule += Pcds

+BuildModule += Defines

+RunCommand(BuildModule)

 #

 # Buid Universal Payload Information Section ".upld_info"

 #

@@ -117,33 +120,34 @@ def BuildUniversalPayload(Args, MacroList):
 fp.write(bytearray(upld_info_hdr))

 fp.close()

 

-#

-# Copy the DXEFV as a section in elf format Universal Payload entry.

-#

-remove_section = '"{}" -I {} -O {} --remove-section .upld_info 
--remove-section .upld.uefi_fv --remove-section .upld.bds_fv {}'.format (

-   LlvmObjcopyPath,

-   ObjCopyFlag,

-   ObjCopyFlag,

-   EntryOutputDir

-   )

-add_section= '"{}" -I {} -O {} --add-section .upld_info={} 
--add-section .upld.uefi_fv={} --add-section .upld.bds_fv={} {}'.format (

-   LlvmObjcopyPath,

-   ObjCopyFlag,

-   ObjCopyFlag,

-   UpldInfoFile,

-   DxeFvOutputDir,

-   BdsFvOutputDir,

-   EntryOutputDir

-   )

-set_section= '"{}" -I {} -O {} --set-section-alignment .upld_info=4 
--set-section-alignment .upld.uefi_fv=16 --set-section-alignment 
.upld.bds_fv=16 {}'.format (

-   LlvmObjcopyPath,

-   ObjCopyFlag,

-   ObjCopyFlag,

-   EntryOutputDir

-   )

-RunCommand(remove_section)

-RunCommand(add_section)

-RunCommand(set_section)

+if Args.BuildEntryOnly == False:

+#

+# Copy the DXEFV as a section in elf format Universal Payload entry.

+#

+remove_section = '"{}" -I {} -O {} --remove-section .upld_info 
--remove-section .upld.uefi_fv --remove-section .upld.bds_fv {}'.format (

+   LlvmObjcopyPath,

+   ObjCopyFlag,

+   ObjCopyFlag,

+   EntryOutputDir

+   )

+add_section= '"{}" -I {} -O {} --add-section .upld_info={} 

Re: [edk2-devel] [PATCH] UefiCpuPkg: Solve that stack top address is not mapped in pagetable

2023-03-22 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Xie, Yuanhao 
> Sent: Tuesday, March 21, 2023 3:30 PM
> To: devel@edk2.groups.io
> Cc: Dong, Guo ; Ni, Ray ; Rhodes,
> Sean ; Lu, James ; Guo, Gua
> ; Kuo, Ted 
> Subject: [PATCH] UefiCpuPkg: Solve that stack top address is not mapped in
> pagetable
> 
> For the case CPU logic index is 0, RSP points to the very top of all AP
> stacks. That address is not mapped in page table.
> 
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Ted Kuo 
> ---
>  UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
> b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
> index 9ebe31795b..5bcdf7726b 100644
> --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
> +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
> @@ -315,6 +315,7 @@ MwaitCheckGeneric:
>  MwaitLoopGeneric:
>  cli
>  movrax, rsp   ; Set Monitor Address
> +subeax, 8 ; To ensure the monitor address is in the 
> page table
>  xorecx, ecx   ; ecx = 0
>  xoredx, edx   ; edx = 0
>  monitor
> --
> 2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101620): https://edk2.groups.io/g/devel/message/101620
Mute This Topic: https://groups.io/mt/97750173/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] MdePkg/Include: Add IPMI KCS definitions

2023-03-22 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, March 23, 2023 10:19 AM
> To: devel@edk2.groups.io; Gao, Liming ; Chang,
> Abner 
> Cc: Liu, Zhiguang ; 'Nickle Wang'
> ; 'Igor Kulchytskyy' ; Oram, Isaac W
> ; Attar, AbdulLateef (Abdul Lateef)
> ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] 回复: [PATCH] MdePkg/Include: Add IPMI KCS
> definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Is that an I/O Port address or an MMIO address?  Can it be either?
In IPMI spec, KCS register base address is defined as I/O mapped 0xca2.
For MCTP over KCS, KCS register base address could be either I/O mapped or 
memory mapped.

> 
> If it must be I/O Port address, then the PCD name should convey that.
Sounds good. I will update the PCD name.

> 
> If it can be either, then need another PCD to specify the type so the Code
> can do the access with the correct IoLib APIs.
We do have a PCD for KCS access type, but that was defined in the Manageability 
package and leverage by both IPMI driver, MCTP driver and KCS manageability 
transport library.

Thanks
Abner
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> > gaoliming via groups.io
> > Sent: Wednesday, March 22, 2023 6:37 PM
> > To: abner.ch...@amd.com; devel@edk2.groups.io
> > Cc: Kinney, Michael D ; Liu, Zhiguang
> > ; 'Nickle Wang' ; 'Igor
> > Kulchytskyy' ; Oram, Isaac W ;
> > 'Abdul Lateef Attar' 
> > Subject: [edk2-devel] 回复: [PATCH] MdePkg/Include: Add IPMI KCS
> > definitions
> >
> > Abner:
> >   This patch also adds one PCD PcdIpmiKcsBaseAddress. I see its
> > default value is 0xca2. Can you add comments for this default value?
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: abner.ch...@amd.com 
> > > 发送时间: 2023年3月3日 10:32
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Michael D Kinney ; Liming Gao
> > > ; Zhiguang Liu ;
> > > Nickle Wang ; Igor Kulchytskyy ;
> > > Isaac Oram ; Abdul Lateef Attar
> > > 
> > > 主题: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> > >
> > > From: Abner Chang 
> > >
> > > BZ #4354
> > > This change adds definitions for IPMI KCS.
> > >
> > > Signed-off-by: Abner Chang 
> > > Cc: Michael D Kinney 
> > > Cc: Liming Gao 
> > > Cc: Zhiguang Liu 
> > > Cc: Nickle Wang 
> > > Cc: Igor Kulchytskyy 
> > > Cc: Isaac Oram 
> > > Cc: Abdul Lateef Attar 
> > > ---
> > >  MdePkg/MdePkg.dec |  5 ++
> > >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 72
> > > +++
> > >  2 files changed, 77 insertions(+)
> > >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> > >
> > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > > 3d08f20d15b..0ed033983bf 100644
> > > --- a/MdePkg/MdePkg.dec
> > > +++ b/MdePkg/MdePkg.dec
> > > @@ -9,6 +9,7 @@
> > >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> > > LP  # Copyright (c) 2022, Loongson Technology Corporation
> > > Limited. All rights reserved.  # Copyright (c) 2021 - 2022, Arm
> > > Limited. All rights reserved.
> > > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > reserved.
> > >  #
> > >  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2332,6
> > > +2333,10 @@
> > ># @Prompt Memory Address of GuidedExtractHandler Table.
> > >
> > >
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
> 0
> > > 00|UINT64|0x30001015
> > >
> > > +  ## This value is the IPMI KCS Interface I/O base address used to
> > transmit
> > > IPMI commands.
> > > +  # @Prompt IPMI KCS Interface I/O Base Address
> > > +
> > >
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress|0xca2|UINT16|0x
> > > 0031
> > > +
> > >  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic,
> PcdsDynamicEx]
> > >## This value is used to set the base address of PCI express hierarchy.
> > ># @Prompt PCI Express Base Address.
> > > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > > new file mode 100644
> > > index 000..2a51698b126
> > > --- /dev/null
> > > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > > @@ -0,0 +1,72 @@
> > > +/** @file
> > > +  IPMI KCS Register Definitions
> > > +
> > > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > reserved.
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > > +
> > > +#ifndef IPMI_KCS_H_
> > > +#define IPMI_KCS_H_
> > > +
> > > +#define IPMI_KCS_STATUS_REGISTER_OFFSET1
> > > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > > +
> > > +///
> > > +/// IPMI KCS Interface Status Bits
> > > +///
> > > +#define IPMI_KCS_OBF   BIT0
> > > +#define IPMI_KCS_IBF   BIT1
> > > +#define IPMI_KCS_SMS_ATN   BIT2
> > > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > 

Re: [edk2-devel] [PATCH] MdePkg/Include: Add IPMI KCS definitions

2023-03-22 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Yes, good suggestion. I will add it.
Thanks
Abner

> -Original Message-
> From: gaoliming 
> Sent: Thursday, March 23, 2023 9:37 AM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: 'Michael D Kinney' ; 'Zhiguang Liu'
> ; 'Nickle Wang' ; 'Igor
> Kulchytskyy' ; 'Isaac Oram' ;
> Attar, AbdulLateef (Abdul Lateef) 
> Subject: 回复: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Abner:
>   This patch also adds one PCD PcdIpmiKcsBaseAddress. I see its default value
> is 0xca2. Can you add comments for this default value?
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: abner.ch...@amd.com 
> > 发送时间: 2023年3月3日 10:32
> > 收件人: devel@edk2.groups.io
> > 抄送: Michael D Kinney ; Liming Gao
> > ; Zhiguang Liu ;
> > Nickle Wang ; Igor Kulchytskyy ;
> > Isaac Oram ; Abdul Lateef Attar
> > 
> > 主题: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> >
> > From: Abner Chang 
> >
> > BZ #4354
> > This change adds definitions for IPMI KCS.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > ---
> >  MdePkg/MdePkg.dec |  5 ++
> >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 72
> > +++
> >  2 files changed, 77 insertions(+)
> >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 3d08f20d15b..0ed033983bf 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -9,6 +9,7 @@
> >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> > LP  # Copyright (c) 2022, Loongson Technology Corporation Limited.
> > All rights reserved.  # Copyright (c) 2021 - 2022, Arm Limited.
> > All rights reserved.
> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> reserved.
> >  #
> >  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2332,6 +2333,10
> > @@
> ># @Prompt Memory Address of GuidedExtractHandler Table.
> >
> >
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
> 0
> > 00|UINT64|0x30001015
> >
> > +  ## This value is the IPMI KCS Interface I/O base address used to
> transmit
> > IPMI commands.
> > +  # @Prompt IPMI KCS Interface I/O Base Address
> > +
> >
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress|0xca2|UINT16|0x
> > 0031
> > +
> >  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >## This value is used to set the base address of PCI express hierarchy.
> ># @Prompt PCI Express Base Address.
> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > new file mode 100644
> > index 000..2a51698b126
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > @@ -0,0 +1,72 @@
> > +/** @file
> > +  IPMI KCS Register Definitions
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > +
> > +#ifndef IPMI_KCS_H_
> > +#define IPMI_KCS_H_
> > +
> > +#define IPMI_KCS_STATUS_REGISTER_OFFSET1
> > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > +
> > +///
> > +/// IPMI KCS Interface Status Bits
> > +///
> > +#define IPMI_KCS_OBF   BIT0
> > +#define IPMI_KCS_IBF   BIT1
> > +#define IPMI_KCS_SMS_ATN   BIT2
> > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > +#define IPMI_KCS_OEM1  BIT4
> > +#define IPMI_KCS_OEM2  BIT5
> > +#define IPMI_KCS_S0BIT6
> > +#define IPMI_KCS_S1BIT7
> > +
> > +///
> > +/// IPMI KCS Interface Control Codes
> > +///
> > +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_START   0x61
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_END 0x62
> > +#define IPMI_KCS_CONTROL_CODE_READ  0x68
> > +
> > +///
> > +/// Status Codes
> > +///
> > +#define IPMI_KCS_STATUS_NO_ERROR  0x00
> > +#define IPMI_KCS_STATUS_ABORT 0x01
> > +#define IPMI_KCS_STATUS_ILLEGAL   0x02
> > +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> > +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> > +
> > +///
> > +/// KCS Interface State Bit
> > +///
> > +typedef enum {
> > +  IPMI_KCS_IDLE_STATE = 0,
> > +  IPMI_KCS_READ_STATE,
> > +  IPMI_KCS_WRITE_STATE,
> > +  IPMI_KCS_ERROR_STATE
> > +} IPMI_KCS_STATE;
> > +
> > +///
> > +/// IPMI KCS Interface Request Format /// typedef struct {
> > +  UINT8NetFunc;
> > +  UINT8Command;
> > +  UINT8Data[0];
> > +} IPMI_KCS_RESQUEST_HEADER;
> > +
> > +///
> > +/// IPMI KCS Interface Response Format /// typedef struct {
> > +  UINT8NetFunc;
> > +  UINT8Command;
> > +  

Re: [edk2-devel] [Patch V3 2/2] MdePkg: Add define for MultiprocessorWakeupMailboxStructure Version

2023-03-22 Thread duntan
Mike and Liming,

Could you please help review this patch?

Thanks,
Dun

-Original Message-
From: devel@edk2.groups.io  On Behalf Of duntan
Sent: Thursday, March 9, 2023 11:40 AM
To: devel@edk2.groups.io
Cc: Kinney, Michael D ; Gao, Liming 
; Liu, Zhiguang ; Ni, Ray 

Subject: [edk2-devel] [Patch V3 2/2] MdePkg: Add define for 
MultiprocessorWakeupMailboxStructure Version

Add define for MultiprocessorWakeupMailboxStructure Version. The version for 
Mailbox Structure in Spec6.4 is 0.

Signed-off-by: Dun Tan 
Cc: Michael D Kinney 
Cc: Liming Gao 
Reviewed-by: Zhiguang Liu 
Cc: Ray Ni 
---
 MdePkg/Include/IndustryStandard/Acpi64.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h 
b/MdePkg/Include/IndustryStandard/Acpi64.h
index bfd022b6b6..379ab02a72 100644
--- a/MdePkg/Include/IndustryStandard/Acpi64.h
+++ b/MdePkg/Include/IndustryStandard/Acpi64.h
@@ -601,6 +601,11 @@ typedef struct {
   UINT64MailBoxAddress;
 } EFI_ACPI_6_4_MULTIPROCESSOR_WAKEUP_STRUCTURE;
 
+///
+/// Multiprocessor Wakeup Mailbox Structure Version (as defined in ACPI 
+6.4 spec.) /// #define 
+EFI_ACPI_6_4_MULTIPROCESSOR_WAKEUP_MAILBOX_STRUCTURE_VERSION  0x0
+
 ///
 /// Multiprocessor Wakeup Mailbox Structure  ///
--
2.31.1.windows.1








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




Re: [edk2-devel] [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 'ApicId' in MpWakeupStructure

2023-03-22 Thread duntan
Mike and Liming,

Could you please help review this patch?

Thanks,
Dun

-Original Message-
From: devel@edk2.groups.io  On Behalf Of duntan
Sent: Thursday, March 9, 2023 11:40 AM
To: devel@edk2.groups.io
Cc: Kinney, Michael D ; Gao, Liming 
; Liu, Zhiguang 
Subject: [edk2-devel] [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 
'ApicId' in MpWakeupStructure

modify the wrong 'AcpiId' to 'ApicId' of MpWakeupStructure defination in 
Acpi64.h.

Signed-off-by: Dun Tan 
Cc: Michael D Kinney 
Cc: Liming Gao 
Reviewed-by: Zhiguang Liu 
---
 MdePkg/Include/IndustryStandard/Acpi64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h 
b/MdePkg/Include/IndustryStandard/Acpi64.h
index fe5ebfac2b..bfd022b6b6 100644
--- a/MdePkg/Include/IndustryStandard/Acpi64.h
+++ b/MdePkg/Include/IndustryStandard/Acpi64.h
@@ -607,7 +607,7 @@ typedef struct {
 typedef struct {
   UINT16Command;
   UINT16Reserved;
-  UINT32AcpiId;
+  UINT32ApicId;
   UINT64WakeupVector;
   UINT8 ReservedForOs[2032];
   UINT8 ReservedForFirmware[2048];
--
2.31.1.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101616): https://edk2.groups.io/g/devel/message/101616
Mute This Topic: https://groups.io/mt/97794153/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] UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug

2023-03-22 Thread Ni, Ray
Thanks for confirming that.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd
> Hoffmann
> Sent: Tuesday, March 21, 2023 7:54 PM
> To: Ni, Ray 
> Cc: devel@edk2.groups.io; Pawel Polawski ; Kumar,
> Rahul R ; Oliver Steffen ;
> Dong, Eric 
> Subject: Re: [edk2-devel] [PATCH 1/1] UefiCpuPkg/MpInitLib: fix apic mode
> for cpu hotplug
> 
> On Tue, Mar 21, 2023 at 07:28:44AM +, Ni, Ray wrote:
> > > +  } else if ((PcdGet32 (PcdCpuBootLogicalProcessorNumber) > 0) &&
> > > + (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 255))
> > > +  {
> > > +X2Apic = TRUE;
> >
> > Gerd,
> > I agree with your needs that want X2 APIC even the actual processor
> number in BIOS phase <= 255.
> >
> > Question: Is it possible that BIOS stays at XAPIC, and later OS switches to 
> > X2
> APIC when the maximum CPU count > 255?
> 
> Linux doesn't do that.  In case x2apic mode is not active at boot the
> number of CPUs will be limited to 255.
> 
> > I am thinking about adding a new PCD to tell MP code switch to x2 apic
> > in the first time AP wakes up. Possible timeline for the code change
> > is about within 1 month. Do you think it can meet your needs?
> 
> So the idea being that OVMF simply sets that PCD if needed (probably at
> the same place where PcdCpuMaxLogicalProcessorNumber is set)?  That
> would work too.
> 
> take care,
>   Gerd
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101615): https://edk2.groups.io/g/devel/message/101615
Mute This Topic: https://groups.io/mt/97447597/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] [edk2-staging/OpenSSL11_EOL][PATCH 4/4] Readme: 0322 update

2023-03-22 Thread Li, Yi
Signed-off-by: Yi Li 
---
 CryptoPkg/Readme-OpenSSL3.0.md | 65 +-
 1 file changed, 57 insertions(+), 8 deletions(-)

diff --git a/CryptoPkg/Readme-OpenSSL3.0.md b/CryptoPkg/Readme-OpenSSL3.0.md
index 85ed37b61d..fc5d24d074 100644
--- a/CryptoPkg/Readme-OpenSSL3.0.md
+++ b/CryptoPkg/Readme-OpenSSL3.0.md
@@ -17,19 +17,26 @@ The branch owner: Li Yi 
 
 ## Latest update
 Will update latest result here (Build based on Intel platform).  
+Binaries mode (use crypto drivers)  
 | Driver  |   1.1.1|3.0 |   percent  |  
 |-||||  
 |CryptoPei|   386  |398 |3.1%|  
 |CryptoPeiPreMem  |   31   |31  |0%  |  
-|CryptoDxeFull|   1014 |1031|1.7%|  
-|CryptoDxe|   804  |886 |10.1%   |  
-|CryptoSmm|   558  |604 |8.2%|  
-
+|CryptoDxeFull|   1014 |997 |-1.6%   |  
+|CryptoDxe|   804  |871 |8.3%|  
+|CryptoSmm|   558  |581 |4.1%|  
+  
 | LZMA Compressed |   1.1.1|3.0 |   percent  |  
 |-||||  
-|CryptoDxe|   311  |350 |12.2%   |  
-|CryptoSmm|   211  |238 |12.8%   |  
-|FV (Dxe+Smm) |   357  |412 |15.4%   |  
+|CryptoDxe|   311  |346 |11.2%   |  
+|CryptoSmm|   211  |233 |10.4%   |  
+|FV (Dxe+Smm) |   357  |406 |13.7%   |  
+
+Library mode (use crypto library)  
+| Driver |   1.1.1|3.0 |delta   |  
+|||||  
+|  FV|   2377 |2639| 262|  
+|SecurityStubDxe.efi |   562  |605 | 43 |  
 
 ## Limitation
 
@@ -49,7 +56,7 @@ More complex API: There will be two code paths supporting 
1.1.1 legacy and 3.0 p
 ### 1.Cut Provider
 As CryptoPkg\Library\OpensslLib\OpensslStub\uefiprov.c
 
-### Remove unnecessary module 
+### 2.Remove unnecessary module 
 SM2,  
 SM3 - 12KB,  
 MD5 - 8KB,  
@@ -105,5 +112,47 @@ remove unused bio prov - 4KB
  Risk:
 This is workaround.
 
+## Openssl code change summary
+### Level 1: Reasonable changes to reduce size
+1. Add macro such like OPENSSL_NO_ECX OPENSSL_NO_ECD to remove ecx and ecd 
feature,  
+will reduce size about 104KB.  
+(commit: ec: disable ecx and ecd)  
+https://github.com/liyi77/openssl/commit/2b0a888c3623e1dc0637fbe0c5dcc1211b4d0545
  
+  
+2. Avoid build error when sm3 disabled.  
+(commit: sm3: avoid build error after sm3 disabled)  
+https://github.com/liyi77/openssl/commit/df92e440e45667da6ca1f9013f015e6d18981f2e
  
+
+### Level 2: A bit like workaround, with possibility of upstream to openssl
+1. Enable the legacy path for X509 pubkey decode and pmeth initialization,  
+The purpose is to avoid the use of EN/DECODE and Signature provider, will 
reduce size about 90KB.  
+(commit: x509: enable legacy path in pub decode)  
+https://github.com/liyi77/openssl/commit/8780956da77c949ca42f6c4c3fd6ef7045646ef0
  
+(commit: evp: enable legacy pmeth)  
+https://github.com/liyi77/openssl/commit/a2232b35aa308198b61c5734c1bfe1d0263f074b
  
+  
+2. Add 'type' field back to enable OPENSSL_NO_AUTOALGINIT,  will reduce size 
about 27KB.  
+issue: https://github.com/openssl/openssl/issues/20221  
+(commit: evp: add type filed back)  
+https://github.com/liyi77/openssl/commit/9c68a18a3a1967baf8d93eacadac9f0e14523715
  
+
+### Level 3: Totally workaround and hard to upstream to openssl, may need 
scripts to apply them inside EDK2
+1. Provider cut.  
+(commit: CryptoPkg: add own openssl provider)  
+https://github.com/liyi77/edk2-staging/commit/c3a5b69d8a3465259cfdca8f38b0dc7683b3690e
  
+  
+2. Cut Name/NID mapping, will reduce size about 70KB.  
+(commit: CryptoPkg: trim obj_dat.h)  
+https://github.com/liyi77/edk2-staging/commit/6874485ebf89959953f7094990c7123e19748527
  
+
+3. Cut unnecessary API in structure.  
+(commit: evp: cut bio_enc func 3KB)  
+https://github.com/liyi77/openssl/commit/3a2331133c2e3bda3e9bdb861ea97e5d3969fb2d
  
+(commit: x509: remove print function 7KB)  
+https://github.com/liyi77/openssl/commit/faa5d6781c3af601bcbc11ff199e2955d7ff4306
  
+(commit: rsa: remove unused rsa ameth 7KB)  
+https://github.com/liyi77/openssl/commit/8488c75701cdd5e626785e6d9d002f6fb30ae0ff
  
+(commit: x509: remove unused extentions 19KB)  
+https://github.com/liyi77/openssl/commit/c27b3428708eb240b626946ce10d4219806d8adf
  
 ## Timeline
 Target for 2023 Q1
\ No newline at end of file
-- 
2.31.1.windows.1



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

[edk2-devel] [edk2-staging/OpenSSL11_EOL][PATCH 3/4] CryptoPkg: update openssl submodule

2023-03-22 Thread Li, Yi
Signed-off-by: Yi Li 
---
 CryptoPkg/Library/OpensslLib/openssl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/OpensslLib/openssl 
b/CryptoPkg/Library/OpensslLib/openssl
index 6048380660..2b0a888c36 16
--- a/CryptoPkg/Library/OpensslLib/openssl
+++ b/CryptoPkg/Library/OpensslLib/openssl
@@ -1 +1 @@
-Subproject commit 6048380660df37d5828c1ff1d343f24a21091715
+Subproject commit 2b0a888c3623e1dc0637fbe0c5dcc1211b4d0545
-- 
2.31.1.windows.1



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




[edk2-devel] [edk2-staging/OpenSSL11_EOL][PATCH 0/4] Openssl 3.0 POC update Mar 22

2023-03-22 Thread Li, Yi
Please check the patch series if interested.
PR: https://github.com/tianocore/edk2-staging/pull/363

Latest size data:
Binaries:   
CryptoDxeFull   1.70%   ->  -1.6%   -17KB
CryptoDxe   10.1%   ->  8.3%68KB
CryptoSmm   8.20%   ->  4.1%23KB
After LZMA: 
CryptoDxe   12.2%   ->  11.20%  35KB
CryptoSmm   12.8%   ->  10.40%  22KB
FV (Dxe+Smm)15.4%   ->  13.70%  49KB

Cc: Jiewen Yao 
Cc: Wenxing Hou 
Cc: Gerd Hoffmann 
Signed-off-by: Yi Li 

Yi Li (4):
  bugfix: use null md5 onlyif no-md5 defined
  CryptoPkg: remove unnecessary sig, ec and rsa prov
  CryptoPkg: update openssl submodule
  Readme: 0322 update

 CryptoPkg/Library/OpensslLib/HashNull.c   |  3 +
 .../Library/OpensslLib/OpensslStub/uefiprov.c | 23 ---
 CryptoPkg/Library/OpensslLib/openssl  |  2 +-
 CryptoPkg/Readme-OpenSSL3.0.md| 65 ---
 4 files changed, 61 insertions(+), 32 deletions(-)

-- 
2.31.1.windows.1



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




[edk2-devel] [edk2-staging/OpenSSL11_EOL][PATCH 1/4] bugfix: use null md5 onlyif no-md5 defined

2023-03-22 Thread Li, Yi
Signed-off-by: Yi Li 
---
 CryptoPkg/Library/OpensslLib/HashNull.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CryptoPkg/Library/OpensslLib/HashNull.c 
b/CryptoPkg/Library/OpensslLib/HashNull.c
index ebd6369f98..e2a4da80a1 100644
--- a/CryptoPkg/Library/OpensslLib/HashNull.c
+++ b/CryptoPkg/Library/OpensslLib/HashNull.c
@@ -20,6 +20,8 @@ int ossl_sm3_final(unsigned char *md, SM3_CTX *c){
 return -1;
 }
 #endif
+
+#ifdef OPENSSL_NO_MD5
 #include "openssl/x509.h"
 const EVP_MD *EVP_md5(void) {
 return NULL;
@@ -41,3 +43,4 @@ int ssl3_cbc_digest_record(const EVP_MD *md,
size_t mac_secret_length, char is_sslv3) {
 return -1;
}
+#endif
-- 
2.31.1.windows.1



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




[edk2-devel] [edk2-staging/OpenSSL11_EOL][PATCH 2/4] CryptoPkg: remove unnecessary sig, ec and rsa prov

2023-03-22 Thread Li, Yi
Signed-off-by: Yi Li 
---
 .../Library/OpensslLib/OpensslStub/uefiprov.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
index c21c475331..4473e3e706 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
@@ -160,9 +160,6 @@ static const OSSL_ALGORITHM deflt_kdfs[] = {
 static const OSSL_ALGORITHM deflt_keyexch[] = {
 #ifndef OPENSSL_NO_DH
 { PROV_NAMES_DH, "provider=default", ossl_dh_keyexch_functions },
-#endif
-#ifndef OPENSSL_NO_EC
-{ PROV_NAMES_ECDH, "provider=default", ossl_ecdh_keyexch_functions },
 #endif
 { PROV_NAMES_TLS1_PRF, "provider=default", 
ossl_kdf_tls1_prf_keyexch_functions },
 { PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_keyexch_functions },
@@ -175,15 +172,6 @@ static const OSSL_ALGORITHM deflt_rands[] = {
 { NULL, NULL, NULL }
 };
 
-static const OSSL_ALGORITHM deflt_signature[] = {
-{ PROV_NAMES_RSA, "provider=default", ossl_rsa_signature_functions },
-#ifndef OPENSSL_NO_EC
-{ PROV_NAMES_ECDSA, "provider=default", ossl_ecdsa_signature_functions },
-#endif
-
-{ NULL, NULL, NULL }
-};
-
 static const OSSL_ALGORITHM deflt_asym_cipher[] = {
 { PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_cipher_functions },
 { NULL, NULL, NULL }
@@ -196,15 +184,6 @@ static const OSSL_ALGORITHM deflt_keymgmt[] = {
 { PROV_NAMES_DHX, "provider=default", ossl_dhx_keymgmt_functions,
   PROV_DESCS_DHX },
 #endif
-
-{ PROV_NAMES_RSA, "provider=default", ossl_rsa_keymgmt_functions,
-  PROV_DESCS_RSA },
-{ PROV_NAMES_RSA_PSS, "provider=default", ossl_rsapss_keymgmt_functions,
-  PROV_DESCS_RSA_PSS },
-#ifndef OPENSSL_NO_EC
-{ PROV_NAMES_EC, "provider=default", ossl_ec_keymgmt_functions,
-  PROV_DESCS_EC },
-#endif
 { PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_keymgmt_functions,
   PROV_DESCS_TLS1_PRF_SIGN },
 { PROV_NAMES_HKDF, "provider=default", ossl_kdf_keymgmt_functions,
@@ -232,8 +211,6 @@ static const OSSL_ALGORITHM *deflt_query(void *provctx, int 
operation_id,
 return deflt_keymgmt;
 case OSSL_OP_KEYEXCH:
 return deflt_keyexch;
-case OSSL_OP_SIGNATURE:
-return deflt_signature;
 case OSSL_OP_ASYM_CIPHER:
 return deflt_asym_cipher;
 }
-- 
2.31.1.windows.1



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




Re: [edk2-devel] 回复: [PATCH] MdePkg/Include: Add IPMI KCS definitions

2023-03-22 Thread Michael D Kinney
Is that an I/O Port address or an MMIO address?  Can it be either?

If it must be I/O Port address, then the PCD name should convey that.

If it can be either, then need another PCD to specify the type so the
Code can do the access with the correct IoLib APIs.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of gaoliming via 
> groups.io
> Sent: Wednesday, March 22, 2023 6:37 PM
> To: abner.ch...@amd.com; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Liu, Zhiguang 
> ; 'Nickle Wang' ;
> 'Igor Kulchytskyy' ; Oram, Isaac W ; 
> 'Abdul Lateef Attar' 
> Subject: [edk2-devel] 回复: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> 
> Abner:
>   This patch also adds one PCD PcdIpmiKcsBaseAddress. I see its default
> value is 0xca2. Can you add comments for this default value?
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: abner.ch...@amd.com 
> > 发送时间: 2023年3月3日 10:32
> > 收件人: devel@edk2.groups.io
> > 抄送: Michael D Kinney ; Liming Gao
> > ; Zhiguang Liu ; Nickle
> > Wang ; Igor Kulchytskyy ; Isaac
> > Oram ; Abdul Lateef Attar
> > 
> > 主题: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> >
> > From: Abner Chang 
> >
> > BZ #4354
> > This change adds definitions for IPMI KCS.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > ---
> >  MdePkg/MdePkg.dec |  5 ++
> >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 72
> > +++
> >  2 files changed, 77 insertions(+)
> >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> > index 3d08f20d15b..0ed033983bf 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -9,6 +9,7 @@
> >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> > LP
> >  # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
> > reserved.
> >  # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> reserved.
> >  #
> >  # SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #
> > @@ -2332,6 +2333,10 @@
> ># @Prompt Memory Address of GuidedExtractHandler Table.
> >
> > gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1
> > 00|UINT64|0x30001015
> >
> > +  ## This value is the IPMI KCS Interface I/O base address used to
> transmit
> > IPMI commands.
> > +  # @Prompt IPMI KCS Interface I/O Base Address
> > +
> > gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress|0xca2|UINT16|0x
> > 0031
> > +
> >  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >## This value is used to set the base address of PCI express hierarchy.
> ># @Prompt PCI Express Base Address.
> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > new file mode 100644
> > index 000..2a51698b126
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > @@ -0,0 +1,72 @@
> > +/** @file
> > +  IPMI KCS Register Definitions
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +**/
> > +
> > +#ifndef IPMI_KCS_H_
> > +#define IPMI_KCS_H_
> > +
> > +#define IPMI_KCS_STATUS_REGISTER_OFFSET1
> > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > +
> > +///
> > +/// IPMI KCS Interface Status Bits
> > +///
> > +#define IPMI_KCS_OBF   BIT0
> > +#define IPMI_KCS_IBF   BIT1
> > +#define IPMI_KCS_SMS_ATN   BIT2
> > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > +#define IPMI_KCS_OEM1  BIT4
> > +#define IPMI_KCS_OEM2  BIT5
> > +#define IPMI_KCS_S0BIT6
> > +#define IPMI_KCS_S1BIT7
> > +
> > +///
> > +/// IPMI KCS Interface Control Codes
> > +///
> > +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_START   0x61
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_END 0x62
> > +#define IPMI_KCS_CONTROL_CODE_READ  0x68
> > +
> > +///
> > +/// Status Codes
> > +///
> > +#define IPMI_KCS_STATUS_NO_ERROR  0x00
> > +#define IPMI_KCS_STATUS_ABORT 0x01
> > +#define IPMI_KCS_STATUS_ILLEGAL   0x02
> > +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> > +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> > +
> > +///
> > +/// KCS Interface State Bit
> > +///
> > +typedef enum {
> > +  IPMI_KCS_IDLE_STATE = 0,
> > +  IPMI_KCS_READ_STATE,
> > +  IPMI_KCS_WRITE_STATE,
> > +  IPMI_KCS_ERROR_STATE
> > +} IPMI_KCS_STATE;
> > +
> > +///
> > +/// IPMI KCS Interface Request Format
> > +///
> > +typedef struct {
> > +  UINT8NetFunc;
> > +  UINT8Command;
> > +  UINT8Data[0];
> > +} IPMI_KCS_RESQUEST_HEADER;
> > +
> > +///
> > +/// 

Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 compliant by using __func__

2023-03-22 Thread Rebecca Cran
Sorry, I didn't realize there were people still using older builds of VS 
2015.



--
Rebecca Cran


On 3/22/23 7:43 PM, Huang, Yanbo wrote:

Hi Rebecca,

The commit message “Visual Studio versions before VS 2015 don't support 
__func__” may cause confuse since some of the older release of VS2015 also do 
not support __func__.
Some of my fellows report the error since they use the VS 2015 version before 
Update 3.

Best Regards,
Yanbo Huang

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael D Kinney
Sent: Thursday, March 23, 2023 8:58 AM
To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming ; Liu, 
Zhiguang ; Michael Kubacki ; Sean 
Brogan 
Cc: Kinney, Michael D 
Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
compliant by using __func__

Hi Rebecca,

Using latest release would be my preference as well and what EDK II should 
recommend.

We should document that the min supported version of VS2015 Update 3.

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca
Cran
Sent: Wednesday, March 22, 2023 10:46 AM
To: Kinney, Michael D ;
devel@edk2.groups.io; Gao, Liming ; Liu,
Zhiguang ; Michael Kubacki
; Sean Brogan

Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more
C11 compliant by using __func__

Can we not require that VS2015 Update 3 is installed?

Do people have reasons to be running older builds, or is it just that
they forget to install the updates?


--
Rebecca Cran


On 3/22/23 10:58 AM, Kinney, Michael D wrote:

Hi Rebecca,

It appears that some of the older release of VS2015 do not support
__func__.

Can you please work on a patch that implements the workaround?

Thanks,

Mike


-Original Message-
From: Kinney, Michael D 
Sent: Friday, March 17, 2023 8:16 AM
To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming
; Liu, Zhiguang ;
Michael Kubacki ; Sean Brogan

Cc: Kinney, Michael D 
Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be
more C11 compliant by using __func__

Hi Rebecca,

For older compilers that do not support __func__, I believe a
workaround could be added to define __func__ to __FUNCTION__.  We
do not need to do this for any of these patches.  It can be
something consumers can do if they really want to use an older compiler.

You can try it out on VS2012 locally.  If it works, then you can
mention that workaround in the commit message.

Do we have any information on GCC/CLANG compatibility for this feature?

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of
Rebecca Cran
Sent: Friday, March 17, 2023 6:32 AM
To: Kinney, Michael D ;
devel@edk2.groups.io; Gao, Liming ; Liu,

Zhiguang

; Michael Kubacki
; Sean Brogan

Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be
more C11 compliant by using __func__

(+Michael Kubacki, Sean Brogan)

Mike, Michael, Sean:


This change is going to break building edk2 with anything older
than Visual Studio 2015, which is where support for __func__ was added.

I checked and currently it appears that VS2013 builds edk2 but
VS2012 has errors. Given that the stuart tools don't support
anything older than VS2017 I'm thinking this is okay, but I want
to double check before pushing this change.


--

Rebecca Cran


On 3/14/23 2:40 PM, Kinney, Michael D wrote:

Reviewed-by: Michael D Kinney 



-Original Message-
From: devel@edk2.groups.io  On Behalf Of
Rebecca Cran
Sent: Monday, March 13, 2023 7:20 PM
To: devel@edk2.groups.io; Kinney, Michael D
; Gao, Liming
; Liu, Zhiguang

Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be
more C11 compliant by using __func__

Mike,


I think your concerns with this patch were addressed?

Could you add a Reviewed-by please?


Thanks.
Rebecca


On 2/9/23 6:01 PM, Michael D Kinney wrote:

Hi Rebecca,

Did this pass EDK II CI?

This change does break EBC compiler builds.  The following has
to be added to MdePkg/Include/Ebc/ProcessorBind.h in order to use __func__ 
everywhere.

#define __func__ __FUNCTION__

I also see __FUNCTION__ used in many packages.  I am wondering
if we want to do this clean up if it should be its own patch
series and update all packages in once series.

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of
Rebecca Cran
Sent: Thursday, February 9, 2023 7:45 AM
To: devel@edk2.groups.io; Kinney, Michael D
; Gao, Liming
;

Liu, Zhiguang


Cc: Rebecca Cran 
Subject: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be
more C11 compliant by using __func__

__FUNCTION__ is a pre-standard extension that gcc and Visual
C++ among others support, while __func__ was standardized in C99.

Since it's more standard, replace __FUNCTION__ with __func__
throughout MdePkg.

Signed-off-by: Rebecca Cran 
---
 MdePkg/Include/Library/PerformanceLib.h
| 12 ++--
 MdePkg/Include/Library/UnitTestLib.h   
| 18 

Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 compliant by using __func__

2023-03-22 Thread Huang, Yanbo
Hi Rebecca,

The commit message “Visual Studio versions before VS 2015 don't support 
__func__” may cause confuse since some of the older release of VS2015 also do 
not support __func__.
Some of my fellows report the error since they use the VS 2015 version before 
Update 3.

Best Regards,
Yanbo Huang

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael D Kinney
Sent: Thursday, March 23, 2023 8:58 AM
To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming 
; Liu, Zhiguang ; Michael 
Kubacki ; Sean Brogan 
Cc: Kinney, Michael D 
Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
compliant by using __func__

Hi Rebecca,

Using latest release would be my preference as well and what EDK II should 
recommend.

We should document that the min supported version of VS2015 Update 3.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca 
> Cran
> Sent: Wednesday, March 22, 2023 10:46 AM
> To: Kinney, Michael D ; 
> devel@edk2.groups.io; Gao, Liming ; Liu, 
> Zhiguang ; Michael Kubacki 
> ; Sean Brogan 
> 
> Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more 
> C11 compliant by using __func__
> 
> Can we not require that VS2015 Update 3 is installed?
> 
> Do people have reasons to be running older builds, or is it just that 
> they forget to install the updates?
> 
> 
> --
> Rebecca Cran
> 
> 
> On 3/22/23 10:58 AM, Kinney, Michael D wrote:
> > Hi Rebecca,
> >
> > It appears that some of the older release of VS2015 do not support 
> > __func__.
> >
> > Can you please work on a patch that implements the workaround?
> >
> > Thanks,
> >
> > Mike
> >
> >> -Original Message-
> >> From: Kinney, Michael D 
> >> Sent: Friday, March 17, 2023 8:16 AM
> >> To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming 
> >> ; Liu, Zhiguang ; 
> >> Michael Kubacki ; Sean Brogan 
> >> 
> >> Cc: Kinney, Michael D 
> >> Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be 
> >> more C11 compliant by using __func__
> >>
> >> Hi Rebecca,
> >>
> >> For older compilers that do not support __func__, I believe a 
> >> workaround could be added to define __func__ to __FUNCTION__.  We 
> >> do not need to do this for any of these patches.  It can be 
> >> something consumers can do if they really want to use an older compiler.
> >>
> >> You can try it out on VS2012 locally.  If it works, then you can 
> >> mention that workaround in the commit message.
> >>
> >> Do we have any information on GCC/CLANG compatibility for this feature?
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: devel@edk2.groups.io  On Behalf Of 
> >>> Rebecca Cran
> >>> Sent: Friday, March 17, 2023 6:32 AM
> >>> To: Kinney, Michael D ; 
> >>> devel@edk2.groups.io; Gao, Liming ; Liu,
> Zhiguang
> >>> ; Michael Kubacki 
> >>> ; Sean Brogan 
> >>> 
> >>> Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be 
> >>> more C11 compliant by using __func__
> >>>
> >>> (+Michael Kubacki, Sean Brogan)
> >>>
> >>> Mike, Michael, Sean:
> >>>
> >>>
> >>> This change is going to break building edk2 with anything older 
> >>> than Visual Studio 2015, which is where support for __func__ was added.
> >>>
> >>> I checked and currently it appears that VS2013 builds edk2 but 
> >>> VS2012 has errors. Given that the stuart tools don't support 
> >>> anything older than VS2017 I'm thinking this is okay, but I want 
> >>> to double check before pushing this change.
> >>>
> >>>
> >>> --
> >>>
> >>> Rebecca Cran
> >>>
> >>>
> >>> On 3/14/23 2:40 PM, Kinney, Michael D wrote:
>  Reviewed-by: Michael D Kinney 
> 
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of 
> > Rebecca Cran
> > Sent: Monday, March 13, 2023 7:20 PM
> > To: devel@edk2.groups.io; Kinney, Michael D 
> > ; Gao, Liming 
> > ; Liu, Zhiguang 
> > 
> > Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be 
> > more C11 compliant by using __func__
> >
> > Mike,
> >
> >
> > I think your concerns with this patch were addressed?
> >
> > Could you add a Reviewed-by please?
> >
> >
> > Thanks.
> > Rebecca
> >
> >
> > On 2/9/23 6:01 PM, Michael D Kinney wrote:
> >> Hi Rebecca,
> >>
> >> Did this pass EDK II CI?
> >>
> >> This change does break EBC compiler builds.  The following has 
> >> to be added to MdePkg/Include/Ebc/ProcessorBind.h in order to use 
> >> __func__ everywhere.
> >>
> >>#define __func__ __FUNCTION__
> >>
> >> I also see __FUNCTION__ used in many packages.  I am wondering 
> >> if we want to do this clean up if it should be its own patch 
> >> series and update all packages in once series.
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: devel@edk2.groups.io  On Behalf Of 
> >>> Rebecca Cran
> >>> Sent: Thursday, February 9, 2023 7:45 AM
> 

[edk2-devel] 回复: [PATCH] MdePkg/Include: Add IPMI KCS definitions

2023-03-22 Thread gaoliming via groups.io
Abner:
  This patch also adds one PCD PcdIpmiKcsBaseAddress. I see its default
value is 0xca2. Can you add comments for this default value?

Thanks
Liming
> -邮件原件-
> 发件人: abner.ch...@amd.com 
> 发送时间: 2023年3月3日 10:32
> 收件人: devel@edk2.groups.io
> 抄送: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu ; Nickle
> Wang ; Igor Kulchytskyy ; Isaac
> Oram ; Abdul Lateef Attar
> 
> 主题: [PATCH] MdePkg/Include: Add IPMI KCS definitions
> 
> From: Abner Chang 
> 
> BZ #4354
> This change adds definitions for IPMI KCS.
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> ---
>  MdePkg/MdePkg.dec |  5 ++
>  MdePkg/Include/IndustryStandard/IpmiKcs.h | 72
> +++
>  2 files changed, 77 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> 
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 3d08f20d15b..0ed033983bf 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -9,6 +9,7 @@
>  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> LP
>  # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
> reserved.
>  # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -2332,6 +2333,10 @@
># @Prompt Memory Address of GuidedExtractHandler Table.
> 
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1
> 00|UINT64|0x30001015
> 
> +  ## This value is the IPMI KCS Interface I/O base address used to
transmit
> IPMI commands.
> +  # @Prompt IPMI KCS Interface I/O Base Address
> +
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress|0xca2|UINT16|0x
> 0031
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>## This value is used to set the base address of PCI express hierarchy.
># @Prompt PCI Express Base Address.
> diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> new file mode 100644
> index 000..2a51698b126
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> @@ -0,0 +1,72 @@
> +/** @file
> +  IPMI KCS Register Definitions
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef IPMI_KCS_H_
> +#define IPMI_KCS_H_
> +
> +#define IPMI_KCS_STATUS_REGISTER_OFFSET1
> +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> +
> +///
> +/// IPMI KCS Interface Status Bits
> +///
> +#define IPMI_KCS_OBF   BIT0
> +#define IPMI_KCS_IBF   BIT1
> +#define IPMI_KCS_SMS_ATN   BIT2
> +#define IPMI_KCS_COMMAND_DATA  BIT3
> +#define IPMI_KCS_OEM1  BIT4
> +#define IPMI_KCS_OEM2  BIT5
> +#define IPMI_KCS_S0BIT6
> +#define IPMI_KCS_S1BIT7
> +
> +///
> +/// IPMI KCS Interface Control Codes
> +///
> +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> +#define IPMI_KCS_CONTROL_CODE_WRITE_START   0x61
> +#define IPMI_KCS_CONTROL_CODE_WRITE_END 0x62
> +#define IPMI_KCS_CONTROL_CODE_READ  0x68
> +
> +///
> +/// Status Codes
> +///
> +#define IPMI_KCS_STATUS_NO_ERROR  0x00
> +#define IPMI_KCS_STATUS_ABORT 0x01
> +#define IPMI_KCS_STATUS_ILLEGAL   0x02
> +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> +
> +///
> +/// KCS Interface State Bit
> +///
> +typedef enum {
> +  IPMI_KCS_IDLE_STATE = 0,
> +  IPMI_KCS_READ_STATE,
> +  IPMI_KCS_WRITE_STATE,
> +  IPMI_KCS_ERROR_STATE
> +} IPMI_KCS_STATE;
> +
> +///
> +/// IPMI KCS Interface Request Format
> +///
> +typedef struct {
> +  UINT8NetFunc;
> +  UINT8Command;
> +  UINT8Data[0];
> +} IPMI_KCS_RESQUEST_HEADER;
> +
> +///
> +/// IPMI KCS Interface Response Format
> +///
> +typedef struct {
> +  UINT8NetFunc;
> +  UINT8Command;
> +  UINT8CompletionCode;
> +} IPMI_KCS_RESPONSE_HEADER;
> +#endif
> --
> 2.37.1.windows.1





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




[edk2-devel] 回复: [PATCH V2] MdePkg/Include: Add IPMI KCS definitions

2023-03-22 Thread gaoliming via groups.io
Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: abner.ch...@amd.com 
> 发送时间: 2023年3月8日 22:47
> 收件人: devel@edk2.groups.io
> 抄送: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu ; Nickle
> Wang ; Igor Kulchytskyy ; Isaac
> Oram ; Abdul Lateef Attar
> 
> 主题: [PATCH V2] MdePkg/Include: Add IPMI KCS definitions
> 
> From: Abner Chang 
> 
> BZ #4354
> This change adds definitions for IPMI KCS.
> 
> Spec ref:
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ip
> mi-second-gen-interface-spec-v2-rev1-1.html
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Acked-by: Isaac Oram 
> ---
>  MdePkg/MdePkg.dec |  5 ++
>  MdePkg/Include/IndustryStandard/IpmiKcs.h | 76
> +++
>  2 files changed, 81 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> 
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 80b65590531..808c487bb49 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -9,6 +9,7 @@
>  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> LP
>  # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
> reserved.
>  # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -2339,6 +2340,10 @@
># @Prompt Memory Address of GuidedExtractHandler Table.
> 
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1
> 00|UINT64|0x30001015
> 
> +  ## This value is the IPMI KCS Interface I/O base address used to
transmit
> IPMI commands.
> +  # @Prompt IPMI KCS Interface I/O Base Address
> +
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsBaseAddress|0xca2|UINT16|0x
> 0031
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>## This value is used to set the base address of PCI express hierarchy.
># @Prompt PCI Express Base Address.
> diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> new file mode 100644
> index 000..c3baf80bd76
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> @@ -0,0 +1,76 @@
> +/** @file
> +  IPMI KCS Register Definitions
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  IPMI Specification
> +  Version 2.0, Rev. 1.1
> +
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ip
> mi-second-gen-interface-spec-v2-rev1-1.html
> +**/
> +
> +#ifndef IPMI_KCS_H_
> +#define IPMI_KCS_H_
> +
> +#define IPMI_KCS_STATUS_REGISTER_OFFSET1
> +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> +
> +///
> +/// IPMI KCS Interface Status Bits
> +///
> +#define IPMI_KCS_OBF   BIT0
> +#define IPMI_KCS_IBF   BIT1
> +#define IPMI_KCS_SMS_ATN   BIT2
> +#define IPMI_KCS_COMMAND_DATA  BIT3
> +#define IPMI_KCS_OEM1  BIT4
> +#define IPMI_KCS_OEM2  BIT5
> +#define IPMI_KCS_S0BIT6
> +#define IPMI_KCS_S1BIT7
> +
> +///
> +/// IPMI KCS Interface Control Codes
> +///
> +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> +#define IPMI_KCS_CONTROL_CODE_WRITE_START   0x61
> +#define IPMI_KCS_CONTROL_CODE_WRITE_END 0x62
> +#define IPMI_KCS_CONTROL_CODE_READ  0x68
> +
> +///
> +/// Status Codes
> +///
> +#define IPMI_KCS_STATUS_NO_ERROR  0x00
> +#define IPMI_KCS_STATUS_ABORT 0x01
> +#define IPMI_KCS_STATUS_ILLEGAL   0x02
> +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> +
> +///
> +/// KCS Interface State Bit
> +///
> +typedef enum {
> +  IPMI_KCS_IDLE_STATE = 0,
> +  IPMI_KCS_READ_STATE,
> +  IPMI_KCS_WRITE_STATE,
> +  IPMI_KCS_ERROR_STATE
> +} IPMI_KCS_STATE;
> +
> +///
> +/// IPMI KCS Interface Request Format
> +///
> +typedef struct {
> +  UINT8NetFunc;
> +  UINT8Command;
> +  UINT8Data[0];
> +} IPMI_KCS_RESQUEST_HEADER;
> +
> +///
> +/// IPMI KCS Interface Response Format
> +///
> +typedef struct {
> +  UINT8NetFunc;
> +  UINT8Command;
> +} IPMI_KCS_RESPONSE_HEADER;
> +#endif
> --
> 2.37.1.windows.1





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




Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Rebecca Cran

On 3/22/23 5:49 AM, Ard Biesheuvel wrote:



The reason I added CLANG3x support for ARM in the past is to ensure
compatibility with the ARM proprietary, Clang based toolchain. At the
time, we went with GNU ld, but I would actually prefer if we could
make this work with LLD as well.


Just to confirm, I'll keep lld for X64 and IA32, but I won't add 
-fuse-ld=lld for ARM or AARCH64 since none of the toolchain definitions 
currently do so.



The problem with trying to use lld for aarch64 is the following error:


GenFw: ERROR 3000: Invalid
  WriteSections64(): 
/home/bcran/uefi/edk2/Build/ArmVirtQemu-AARCH64/RELEASE_CLANGDWARF/AARCH64/ArmVirtPkg/MemoryInitPei/MemoryInitPeim/DEBUG/MemoryInit.dll 
due to its size (> 1 MB), this module requires 4 KB section alignment.



--

Rebecca Cran



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




[edk2-devel] 回复: [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 'ApicId' in MpWakeupStructure

2023-03-22 Thread gaoliming via groups.io
Dun:
  OK. Reviewed-by: Liming Gao  

  Can you create PR for this patch set? I will merge this PR. 

Thanks
Liming
> -邮件原件-
> 发件人: Tan, Dun 
> 发送时间: 2023年3月10日 14:17
> 收件人: Gao, Liming ; devel@edk2.groups.io
> 抄送: Kinney, Michael D ; Liu, Zhiguang
> 
> 主题: RE: [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 'ApicId' in
> MpWakeupStructure
> 
> Hi Liming,
> 
> I've checked edk2 and edk2-platforms repo. This code change doesn't
> impacted any code.
> The MultiprocessorWakeupMailbox structure has not been used yet.
> 
> Thanks,
> Dun
> 
> -Original Message-
> From: gaoliming 
> Sent: Friday, March 10, 2023 10:16 AM
> To: Tan, Dun ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Liu, Zhiguang
> 
> Subject: 回复: [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 'ApicId'
> in MpWakeupStructure
> 
> Dun:
>   Is there any code impact with this change?
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: Dun Tan 
> > 发送时间: 2023年3月9日 11:40
> > 收件人: devel@edk2.groups.io
> > 抄送: Michael D Kinney ; Liming Gao
> > ; Zhiguang Liu 
> > 主题: [Patch V3 1/2] MdePkg: modify the wrong 'AcpiId' to 'ApicId' in
> > MpWakeupStructure
> >
> > modify the wrong 'AcpiId' to 'ApicId' of MpWakeupStructure defination
> > in Acpi64.h.
> >
> > Signed-off-by: Dun Tan 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Reviewed-by: Zhiguang Liu 
> > ---
> >  MdePkg/Include/IndustryStandard/Acpi64.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h
> > b/MdePkg/Include/IndustryStandard/Acpi64.h
> > index fe5ebfac2b..bfd022b6b6 100644
> > --- a/MdePkg/Include/IndustryStandard/Acpi64.h
> > +++ b/MdePkg/Include/IndustryStandard/Acpi64.h
> > @@ -607,7 +607,7 @@ typedef struct {
> >  typedef struct {
> >UINT16Command;
> >UINT16Reserved;
> > -  UINT32AcpiId;
> > +  UINT32ApicId;
> >UINT64WakeupVector;
> >UINT8 ReservedForOs[2032];
> >UINT8 ReservedForFirmware[2048];
> > --
> > 2.31.1.windows.1
> 
> 





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




Re: 回复: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-22 Thread Rebecca Cran

I've created https://bugzilla.tianocore.org/show_bug.cgi?id=4384 .


--
Rebecca Cran


On 3/22/23 7:05 PM, gaoliming wrote:

Rebecca:
   Can you submit BZ for this change? This change belongs to the feature. I 
would like to add it into stable tag feature planning.

Thanks
Liming

-邮件原件-
发件人: Oliver Smith-Denny 
发送时间: 2023年3月23日 0:37
收件人: devel@edk2.groups.io; rebe...@bsdio.com; Michael D Kinney
; Liming Gao ;
Zhiguang Liu ; Bob Feng ;
Yuwei Chen ; Andrew Fish ; Leif
Lindholm ; Ard Biesheuvel
; Jordan Justen ;
Gerd Hoffmann 
主题: Re: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg:
Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013,
EBC

Thanks for the cleanup!

Reviewed-by: Oliver Smith-Denny 

On 3/21/2023 6:30 PM, Rebecca Cran wrote:

Update the toolchain definitions:

- Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
CLANGDWARF, updating it to support ARM and AARCH64 in addition to

X64

and IA32.

- Remove VS2008, VS2010, VS2012 and VS2013.

- Remove EBC compiler definitions. Full removal of EBC support from the
various packages etc. will be done in a follow-up patch series.

- Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS

definitions.

Personal GitHub PR: https://github.com/tianocore/edk2/pull/4158
GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf

Rebecca Cran (9):
OvmfPkg: Replace static struct initialization with ZeroMem call
CryptoPkg: Add CLANGDWARF and remove CLANG35 and CLANG38

compiler

  flags
BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and

CLANG38

BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
BaseTools: Remove VS2008-VS2013 remnants
MdePkg: Remove VS2008-VS2013 remnants
edksetup.bat: Remove VS2008-VS2013 remnants
BaseTools: Remove unused IPHONE_TOOLS and

SOURCERY_CYGWIN_TOOLS defs

BaseTools: Remove EBC (EFI Byte Code) compiler definitions

   CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf |

3 +-

   CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  |3

+-

   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  |

3 +-

   CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  |

3 +-

   CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  |

3 +-

   CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf |3

+-

   CryptoPkg/Library/OpensslLib/OpensslLib.inf |

3 +-

   CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf|3

+-

   CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   |3

+-

   CryptoPkg/Library/OpensslLib/OpensslLibFull.inf |3

+-

   CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf|3

+-

   MdePkg/Include/Ia32/ProcessorBind.h |

8 +-

   MdePkg/Include/X64/ProcessorBind.h  |

8 +-

   OvmfPkg/Library/PlatformInitLib/MemDetect.c |

4 +-

   BaseTools/Conf/tools_def.template   |

1572 +++-

   BaseTools/Scripts/SetVisualStudio.bat   |

22 +-

   BaseTools/Scripts/ShowEnvironment.bat   |

44 -

   BaseTools/get_vsvars.bat|

13 -

   BaseTools/set_vsprefix_envs.bat |

64 -

   BaseTools/toolsetup.bat |

24 +-

   edksetup.bat

|6 +-

   21 files changed, 192 insertions(+), 1606 deletions(-)






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




回复: [edk2-devel] [PATCH 0/3] BaseTools: allow users to override CC and CXX on the make command line

2023-03-22 Thread gaoliming via groups.io
Rebecca:
  This patch looks good to me. Reviewed-by: Liming Gao 
 

  I will help to merge this patch set. 

Thanks
Liming
> -邮件原件-
> 发件人: Rebecca Cran 
> 发送时间: 2023年3月15日 0:17
> 收件人: devel@edk2.groups.io; Andrew Fish ; Leif
> Lindholm ; Michael D Kinney
> ; Bob Feng ; Liming
> Gao ; Yuwei Chen 
> 主题: Re: [edk2-devel] [PATCH 0/3] BaseTools: allow users to override CC and
> CXX on the make command line
> 
> This is a patch series that I'd really like to get committed.
> 
> It'll allow us to drop the dependency on gcc for building edk2 on FreeBSD.
> 
> 
> The Github branch is https://github.com/bcran/edk2/tree/mdepkg-c11 and
> there's a PR at https://github.com/tianocore/edk2/pull/4142.
> 
> 
> --
> 
> Rebecca Cran
> 
> 
> On 3/9/23 8:47 AM, Rebecca Cran wrote:
> > Could I get some reviews on this please?
> >
> >
> > Thanks.
> >
> > Rebecca Cran
> >
> >
> > On 2/16/23 8:50 PM, Rebecca Cran wrote:
> >> Currently, the BaseTools Makefiles use BUILD_CC and BUILD_CXX, which
> >> doesn't allow users to override the compiler to use in the expected way
> >> by running e.g. "make CC=clang-17 CXX=clang++-17". clang/llvm support
> >> was added in https://bugzilla.tianocore.org/show_bug.cgi?id=2842 in a
> >> way that required users to run "make CXX=llvm" and have clang and
> >> clang++
> >> executables under $(CLANG_BIN). As far as I know this isn't a standard
> >> way of telling a build system to use clang, and so is likely difficult
> >> to discover by users.
> >>
> >> This patch series fixes that, and as a side effect allows the clang
> >> analyzer to run via "scan-build make".
> >>
> >> Since clang 17 defaults to C++17 or newer where the 'register' keyword
> >> is deprecated and the warning turned into an error, override the
> >> version used when building C++ code via "-std=c++14".
> >>
> >> Rebecca Cran (3):
> >>BaseTools: Allow users to specify compiler to use with make CC=
> CXX=
> >>BaseTools: Improve detection of users wanting to build using clang
> >>BaseTools: Build against C++14 when building with clang
> >>
> >>   BaseTools/Source/C/DevicePath/GNUmakefile  |  7 ++-
> >>   BaseTools/Source/C/LzmaCompress/GNUmakefile|  2 +-
> >>   BaseTools/Source/C/Makefiles/app.makefile  |  2 +-
> >>   BaseTools/Source/C/Makefiles/footer.makefile   |  6 +-
> >>   BaseTools/Source/C/Makefiles/header.makefile   | 59
> >> ++--
> >>   BaseTools/Source/C/VfrCompile/GNUmakefile  | 19
> ---
> >>   BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 20 +++
> >>   BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 31 +-
> >>   BaseTools/Source/Python/Workspace/DscBuildData.py  |  2 +-
> >>   9 files changed, 76 insertions(+), 72 deletions(-)
> >>




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




回复: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-22 Thread gaoliming via groups.io
Rebecca:
  Can you submit BZ for this change? This change belongs to the feature. I 
would like to add it into stable tag feature planning. 

Thanks
Liming
> -邮件原件-
> 发件人: Oliver Smith-Denny 
> 发送时间: 2023年3月23日 0:37
> 收件人: devel@edk2.groups.io; rebe...@bsdio.com; Michael D Kinney
> ; Liming Gao ;
> Zhiguang Liu ; Bob Feng ;
> Yuwei Chen ; Andrew Fish ; Leif
> Lindholm ; Ard Biesheuvel
> ; Jordan Justen ;
> Gerd Hoffmann 
> 主题: Re: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg:
> Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013,
> EBC
> 
> Thanks for the cleanup!
> 
> Reviewed-by: Oliver Smith-Denny 
> 
> On 3/21/2023 6:30 PM, Rebecca Cran wrote:
> > Update the toolchain definitions:
> >
> > - Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
> >CLANGDWARF, updating it to support ARM and AARCH64 in addition to
> X64
> > and IA32.
> >
> > - Remove VS2008, VS2010, VS2012 and VS2013.
> >
> > - Remove EBC compiler definitions. Full removal of EBC support from the
> >various packages etc. will be done in a follow-up patch series.
> >
> > - Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS
> definitions.
> >
> > Personal GitHub PR: https://github.com/tianocore/edk2/pull/4158
> > GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf
> >
> > Rebecca Cran (9):
> >OvmfPkg: Replace static struct initialization with ZeroMem call
> >CryptoPkg: Add CLANGDWARF and remove CLANG35 and CLANG38
> compiler
> >  flags
> >BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and
> CLANG38
> >BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
> >BaseTools: Remove VS2008-VS2013 remnants
> >MdePkg: Remove VS2008-VS2013 remnants
> >edksetup.bat: Remove VS2008-VS2013 remnants
> >BaseTools: Remove unused IPHONE_TOOLS and
> SOURCERY_CYGWIN_TOOLS defs
> >BaseTools: Remove EBC (EFI Byte Code) compiler definitions
> >
> >   CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf |
> 3 +-
> >   CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  |3
> +-
> >   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  |
> 3 +-
> >   CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  |
> 3 +-
> >   CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  |
> 3 +-
> >   CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf |3
> +-
> >   CryptoPkg/Library/OpensslLib/OpensslLib.inf |
> 3 +-
> >   CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf|3
> +-
> >   CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   |3
> +-
> >   CryptoPkg/Library/OpensslLib/OpensslLibFull.inf |3
> +-
> >   CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf|3
> +-
> >   MdePkg/Include/Ia32/ProcessorBind.h |
> 8 +-
> >   MdePkg/Include/X64/ProcessorBind.h  |
> 8 +-
> >   OvmfPkg/Library/PlatformInitLib/MemDetect.c |
> 4 +-
> >   BaseTools/Conf/tools_def.template   |
> 1572 +++-
> >   BaseTools/Scripts/SetVisualStudio.bat   |
> 22 +-
> >   BaseTools/Scripts/ShowEnvironment.bat   |
> 44 -
> >   BaseTools/get_vsvars.bat|
> 13 -
> >   BaseTools/set_vsprefix_envs.bat |
> 64 -
> >   BaseTools/toolsetup.bat |
> 24 +-
> >   edksetup.bat
> |6 +-
> >   21 files changed, 192 insertions(+), 1606 deletions(-)
> >




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




Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 compliant by using __func__

2023-03-22 Thread Michael D Kinney
Hi Rebecca,

Using latest release would be my preference as well and what EDK II should 
recommend.

We should document that the min supported version of VS2015 Update 3.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
> Sent: Wednesday, March 22, 2023 10:46 AM
> To: Kinney, Michael D ; devel@edk2.groups.io; 
> Gao, Liming ; Liu, Zhiguang
> ; Michael Kubacki ; 
> Sean Brogan 
> Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> compliant by using __func__
> 
> Can we not require that VS2015 Update 3 is installed?
> 
> Do people have reasons to be running older builds, or is it just that
> they forget to install the updates?
> 
> 
> --
> Rebecca Cran
> 
> 
> On 3/22/23 10:58 AM, Kinney, Michael D wrote:
> > Hi Rebecca,
> >
> > It appears that some of the older release of VS2015 do not support
> > __func__.
> >
> > Can you please work on a patch that implements the workaround?
> >
> > Thanks,
> >
> > Mike
> >
> >> -Original Message-
> >> From: Kinney, Michael D 
> >> Sent: Friday, March 17, 2023 8:16 AM
> >> To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming 
> >> ; Liu, Zhiguang ;
> >> Michael Kubacki ; Sean Brogan 
> >> 
> >> Cc: Kinney, Michael D 
> >> Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> >> compliant by using __func__
> >>
> >> Hi Rebecca,
> >>
> >> For older compilers that do not support __func__, I believe a workaround
> >> could be added to define __func__ to __FUNCTION__.  We do not need to do
> >> this for any of these patches.  It can be something consumers can do if
> >> they really want to use an older compiler.
> >>
> >> You can try it out on VS2012 locally.  If it works, then you can mention
> >> that workaround in the commit message.
> >>
> >> Do we have any information on GCC/CLANG compatibility for this feature?
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: devel@edk2.groups.io  On Behalf Of Rebecca 
> >>> Cran
> >>> Sent: Friday, March 17, 2023 6:32 AM
> >>> To: Kinney, Michael D ; devel@edk2.groups.io; 
> >>> Gao, Liming ; Liu,
> Zhiguang
> >>> ; Michael Kubacki ; 
> >>> Sean Brogan 
> >>> Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> >>> compliant by using __func__
> >>>
> >>> (+Michael Kubacki, Sean Brogan)
> >>>
> >>> Mike, Michael, Sean:
> >>>
> >>>
> >>> This change is going to break building edk2 with anything older than
> >>> Visual Studio 2015, which is where support for __func__ was added.
> >>>
> >>> I checked and currently it appears that VS2013 builds edk2 but VS2012
> >>> has errors. Given that the stuart tools don't support anything older
> >>> than VS2017 I'm thinking this is okay, but I want to double check before
> >>> pushing this change.
> >>>
> >>>
> >>> --
> >>>
> >>> Rebecca Cran
> >>>
> >>>
> >>> On 3/14/23 2:40 PM, Kinney, Michael D wrote:
>  Reviewed-by: Michael D Kinney 
> 
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Rebecca 
> > Cran
> > Sent: Monday, March 13, 2023 7:20 PM
> > To: devel@edk2.groups.io; Kinney, Michael D 
> > ; Gao, Liming ;
> > Liu, Zhiguang 
> > Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more 
> > C11 compliant by using __func__
> >
> > Mike,
> >
> >
> > I think your concerns with this patch were addressed?
> >
> > Could you add a Reviewed-by please?
> >
> >
> > Thanks.
> > Rebecca
> >
> >
> > On 2/9/23 6:01 PM, Michael D Kinney wrote:
> >> Hi Rebecca,
> >>
> >> Did this pass EDK II CI?
> >>
> >> This change does break EBC compiler builds.  The following has to be 
> >> added to
> >> MdePkg/Include/Ebc/ProcessorBind.h in order to use __func__ everywhere.
> >>
> >>#define __func__ __FUNCTION__
> >>
> >> I also see __FUNCTION__ used in many packages.  I am wondering if we 
> >> want
> >> to do this clean up if it should be its own patch series and update all
> >> packages in once series.
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: devel@edk2.groups.io  On Behalf Of 
> >>> Rebecca Cran
> >>> Sent: Thursday, February 9, 2023 7:45 AM
> >>> To: devel@edk2.groups.io; Kinney, Michael D 
> >>> ; Gao, Liming ;
> > Liu, Zhiguang
> >>> 
> >>> Cc: Rebecca Cran 
> >>> Subject: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> >>> compliant by using __func__
> >>>
> >>> __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among
> >>> others support, while __func__ was standardized in C99.
> >>>
> >>> Since it's more standard, replace __FUNCTION__ with __func__ 
> >>> throughout
> >>> MdePkg.
> >>>
> >>> Signed-off-by: Rebecca Cran 
> >>> ---
> >>> MdePkg/Include/Library/PerformanceLib.h   
> >>>  

Re: [edk2-devel] [PATCH v1 5/6] Uefipayloadpkg Enable TPM measured boot

2023-03-22 Thread Guo, Gua
>From Uefi UPL side


Currently, SPI have silicon dependency so native is not support on 
UniversalPayload, please use SECURITY_SUPPORT
+--+
| UefiUPL.elf   |
+--+
| .upld_info |
+--+
| .upld.uefi_fv|
+--+
| .upld.bds_fv |
+--+
| .upld.security_fv  |< SECURITY_SUPPORT (Use this macro to 
decide include it or not and default value is false)
+--+

Thanks,
Gua

-Original Message-
From: Lakkimsetti, Subash  
Sent: Wednesday, March 22, 2023 1:59 PM
To: devel@edk2.groups.io
Cc: Lakkimsetti, Subash ; Dong, Guo 
; Ni, Ray ; Rhodes, Sean 
; Lu, James ; Guo, Gua 
; Rudolph, Patrick 
Subject: [PATCH v1 5/6] Uefipayloadpkg Enable TPM measured boot

From: Subash Lakkimsetti 

Update the packages to support TPM and measured boot in uefi payload.

Measured boot can be controoled using flag MEASURED_BOOT_ENABLE

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Patrick Rudolph 
Signed-off-by: Subash Lakkimsetti 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 88 +--  
UefiPayloadPkg/UefiPayloadPkg.fdf | 25 +
 2 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index f31e5aac16..86612338bf 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -46,6 +46,7 @@
   DEFINE NVME_ENABLE  = TRUEDEFINE SECURE_BOOT_ENABLE  
 = FALSE+  DEFINE MEASURED_BOOT_ENABLE = FALSE#   # NULL:
NullMemoryTestDxe@@ -297,14 +298,27 @@
 !else   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif-!if $(VARIABLE_SUPPORT) == "EMU"-  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf-!elseif
 $(VARIABLE_SUPPORT) == "SPI"-  
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf+
  #+  # TPM+  #+!if $(MEASURED_BOOT_ENABLE) == TRUE+  
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf+  
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf+  
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf+  
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf+  
Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf+
  
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf 
  
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf+!else+
  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf+!endif+!if
 $(VARIABLE_SUPPORT) == "SPI"   
S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf+!endif+!if
 $(SECURE_BOOT_ENABLE) == TRUE || $(MEASURED_BOOT_ENABLE) == TRUE || 
$(VARIABLE_SUPPORT) == "SPI"   
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf 
!endif+  
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf  
 
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf@@
 -412,6 +426,10 @@
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf !endif +!if 
$(MEASURED_BOOT_ENABLE) == TRUE+ 
Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf+!endif+
 

 # # Pcd Section - list of all EDK II PCD Entries defined by this Platform.@@ 
-600,6 +618,13 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdFirmwareDebuggerInitialized|FALSE   
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x5a, 0xf2, 0x6b, 0x28, 0xc3, 
0xc2, 0x8c, 0x40, 0xb3, 0xb4, 0x25, 0xe6, 0x75, 0x8b, 0x73, 0x17} +!if 
$(MEASURED_BOOT_ENABLE) == TRUE++  # (BIT0 - SHA1. BIT1 - SHA256, BIT2 - 
SHA384, BIT3 - SHA512, BIT4 - SM3_256)+  
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x00016+  
gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap|0x00016+!endif+ 

 # # Components Section - list of all EDK II Modules needed by this Platform.@@ 
-680,6 +705,10 @@
  !if $(SECURE_BOOT_ENABLE)   
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf+!endif+!if
 $(MEASURED_BOOT_ENABLE) == TRUE+  
NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf+  
NULL|SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf !endif   
} !endif@@ -842,6 +871,57 @@
   

Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Rebecca Cran

Also "where clang" please.

And could you provide more of the build output please? Perhaps on 
https://pastebin.com/ ?



Thanks.

Rebecca Cran


On 3/22/23 4:07 PM, Guo, Gua wrote:


Mine are:

-Original Message-
From: Rebecca Cran 
Sent: Wednesday, March 22, 2023 9:11 PM
To: Guo, Gua ; devel@edk2.groups.io; Kinney, 
Michael D ; Gao, Liming 
; Liu, Zhiguang ; 
Feng, Bob C ; Chen, Christine 
; Andrew Fish ; Leif Lindholm 
; Ard Biesheuvel 
; Justen, Jordan L 
; Gerd Hoffmann 
Subject: Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF 
toolchain and remove CLANG35 and CLANG38


I'm not seeing this failure. Could you tell me what the following 
commands print, please:


where clang

where lld

Mine are:

C:\Users\bcran\Documents\src\uefi\edk2>where clang

C:\Program Files\LLVM\bin\clang.exe

C:\Program Files (x86)\Microsoft Visual

Studio\2019\Professional\VC\Tools\Llvm\bin\clang.exe

C:\Users\bcran\Documents\src\uefi\edk2>where lld

C:\Program Files\LLVM\bin\lld.exe

C:\Program Files (x86)\Microsoft Visual

Studio\2019\Professional\VC\Tools\Llvm\bin\lld.exe

Also, could you provide more of the output?

On 3/21/23 10:57 PM, Guo, Gua wrote:

>

> Try to verify the patch on my local. Could you help to check whether

> it happen on your side ?

>

> Please make sure windows build is not broken before code submitting.

>

> Before the commit:

>

>   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> VS2019 PASS

>   o Install

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 



>   o Install VS2019

>   o edksetup.bat Rebuild

>   o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

>

>   * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> GCC5 PASS

>   o sudo apt install clang-10 llvm-10

>   o source edksetup.sh

>   o make -C BaseTools

>   o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

>

> After the commit:

>

>   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> VS2019 FAIL

>   o Install

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 



>   o Install VS2019

>   o edksetup.bat Rebuild

>   o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

>  o

>

>   * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> GCC5 PASS

>   o sudo apt install clang-10 llvm-10

>   o source edksetup.sh

>   o make -C BaseTools

>   o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

>

> Thanks,

>

> Gua

>

> -Original Message-

>

> From: devel@edk2.groups.io  
mailto:devel@edk2.groups.io>> On Behalf Of Rebecca


> Cran

>

> Sent: Wednesday, March 22, 2023 9:31 AM

>

> To: devel@edk2.groups.io ; Kinney, 
Michael D


> mailto:michael.d.kin...@intel.com>>; 
Gao, Liming mailto:gaolim...@byosoft.com.cn>>;


> Liu, Zhiguang >; Feng, Bob C


> mailto:bob.c.f...@intel.com>>; Chen, 
Christine mailto:yuwei.c...@intel.com>>; Andrew


> Fish mailto:af...@apple.com>>; Leif Lindholm 
mailto:quic_llind...@quicinc.com>>; Ard


> Biesheuvel >; Justen, Jordan L


> mailto:jordan.l.jus...@intel.com>>; Gerd 
Hoffmann mailto:kra...@redhat.com>>


>

> Cc: Rebecca Cran mailto:rebe...@bsdio.com>>

>

> Subject: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF

> toolchain and remove CLANG35 and CLANG38

>

> Update the CLANGDWARF toolchain definition with the settings from

> CLANG38, and delete the CLANG35 and CLANG38 toolchains.

>

> The existing CLANGDWARF toolchain definition used ld.lld, but this

> causes the following linker errors when building OvmfPkgX64.dsc:

>

> ld.lld: error: relocation R_X86_64_64 cannot be used against local

> symbol; recompile with -fPIC

>

> >>> defined in

>

> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>

> >>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>

> >>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>

> >>> referenced by

> 
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>

> >>> ExceptionHandlerAsm.obj:(.text+0x5) in archive

>

> >>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiC

>

> >>> puPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OU

>

> >>> TPUT/SecPeiCpuExceptionHandlerLib.lib

>

> ld.lld: error: relocation R_X86_64_64 cannot be used against local

> symbol; recompile with -fPIC

>

> >>> defined in

>

> >>> 

Re: [edk2-devel] [PATCH v2 3/6] MdePkg/Base.h: Introduce various alignment-related macros

2023-03-22 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Gerd Hoffmann 
> Sent: Wednesday, March 22, 2023 12:03 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Aktas, Erdem 
> ; James Bottomley ;
> Gao, Liming ; Marvin Häuser ; 
> Pawel Polawski ; Michael Roth
> ; Tom Lendacky ; Gerd Hoffmann 
> ; Yao, Jiewen
> ; Wang, Jian J ; Ard Biesheuvel 
> ; Justen, Jordan L
> ; Wu, Hao A ; Liu, Zhiguang 
> ; Ni, Ray ;
> Xu, Min M ; Oliver Steffen ; Vitaly 
> Cheptsov 
> Subject: [PATCH v2 3/6] MdePkg/Base.h: Introduce various alignment-related 
> macros
> 
> From: Marvin Häuser 
> 
> ALIGNOF: Determining the alignment requirement of data types is
> crucial to ensure safe memory accesses when parsing untrusted data.
> 
> IS_POW2: Determining whether a value is a power of two is important
> to verify whether untrusted values are valid alignment values.
> 
> IS_ALIGNED: In combination with ALIGNOF data offsets can be verified.
> A more general version of the IS_ALIGNED macro previously defined by several 
> modules.
> 
> ADDRESS_IS_ALIGNED: Variant of IS_ALIGNED for pointers and addresses.
> Replaces module-specific definitions throughout the codebase.
> 
> ALIGN_VALUE_ADDEND: The addend to align up can be used to directly
> determine the required offset for data alignment.
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Vitaly Cheptsov 
> Signed-off-by: Marvin Häuser 
> Signed-off-by: Gerd Hoffmann 
> ---
>  MdePkg/Include/Base.h | 98 ++-
>  1 file changed, 97 insertions(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
> index e89c84962ab2..6597e441a6e2 100644
> --- a/MdePkg/Include/Base.h
> +++ b/MdePkg/Include/Base.h
> @@ -758,6 +758,40 @@ typedef UINTN *BASE_LIST;
>  #define OFFSET_OF(TYPE, Field)  ((UINTN) &(((TYPE *)0)->Field))
>  #endif
> 
> +/**
> +  Returns the alignment requirement of a type.
> +
> +  @param   TYPE  The name of the type to retrieve the alignment requirement 
> of.
> +
> +  @return  Alignment requirement, in Bytes, of TYPE.
> +**/
> +#if defined (__cplusplus)
> +//
> +// Standard C++ operator.
> +//
> +#define ALIGNOF(TYPE)  alignof (TYPE)
> +#elif defined (__GNUC__) || defined (__clang__) || (defined (_MSC_VER) && 
> _MSC_VER >= 1900)
> +//
> +// All supported versions of GCC and Clang, as well as MSVC 2015 and later,
> +// support the standard operator _Alignof.
> +//
> +#define ALIGNOF(TYPE)  _Alignof (TYPE)
> +#elif defined (_MSC_EXTENSIONS)
> +//
> +// Earlier versions of MSVC, at least MSVC 2008 and later, support the vendor
> +// extension __alignof.
> +//
> +#define ALIGNOF(TYPE)  __alignof (TYPE)
> +#else
> +//
> +// For compilers that do not support inbuilt alignof operators, use 
> OFFSET_OF.
> +// CHAR8 is known to have both a size and an alignment requirement of 1 Byte.
> +// As such, A must be located exactly at the offset equal to its alignment
> +// requirement.
> +//
> +#define ALIGNOF(TYPE)  OFFSET_OF (struct { CHAR8 C; TYPE A; }, A)
> +#endif
> +
>  /**
>Portable definition for compile time assertions.
>Equivalent to C11 static_assert macro from assert.h.
> @@ -793,6 +827,21 @@ STATIC_ASSERT (sizeof (CHAR16)  == 2, "sizeof (CHAR16) 
> does not meet UEFI Specif
>  STATIC_ASSERT (sizeof (L'A')== 2, "sizeof (L'A') does not meet UEFI 
> Specification Data Type requirements");
>  STATIC_ASSERT (sizeof (L"A")== 4, "sizeof (L\"A\") does not meet UEFI 
> Specification Data Type requirements");
> 
> +STATIC_ASSERT (ALIGNOF (BOOLEAN) == sizeof (BOOLEAN), "Alignment of BOOLEAN 
> does not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (INT8)== sizeof (INT8), "Alignment of INT8 does 
> not meet UEFI Specification Data Type requirements");
> +STATIC_ASSERT (ALIGNOF (UINT8)   == sizeof (UINT8), "Alignment of INT16 does 
> not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (INT16)   == sizeof (INT16), "Alignment of INT16 does 
> not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (UINT16)  == sizeof (UINT16), "Alignment of UINT16 
> does not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (INT32)   == sizeof (INT32), "Alignment of INT32 does 
> not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (UINT32)  == sizeof (UINT32), "Alignment of UINT32 
> does not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (INT64)   == sizeof (INT64), "Alignment of INT64 does 
> not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (UINT64)  == sizeof (UINT64), "Alignment of UINT64 
> does not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (CHAR8)   == sizeof (CHAR8), "Alignment of CHAR8 does 
> not meet UEFI Specification Data Type
> requirements");
> +STATIC_ASSERT (ALIGNOF (CHAR16)  == sizeof (CHAR16), "Alignment of CHAR16 
> does not 

Re: [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() macro.

2023-03-22 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd Hoffmann
> Sent: Wednesday, March 22, 2023 12:03 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Aktas, Erdem 
> ; James Bottomley ;
> Gao, Liming ; Marvin Häuser ; 
> Pawel Polawski ; Michael Roth
> ; Tom Lendacky ; Gerd Hoffmann 
> ; Yao, Jiewen
> ; Wang, Jian J ; Ard Biesheuvel 
> ; Justen, Jordan L
> ; Wu, Hao A ; Liu, Zhiguang 
> ; Ni, Ray ;
> Xu, Min M ; Oliver Steffen 
> Subject: [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() 
> macro.
> 
> Drop MtrrLibIsPowerOfTwo function, use the new IS_POW2() macro instead.
> 
> The ASSERT() removed (inside MtrrLibIsPowerOfTwo) is superfluous,
> another ASSERT() a few lines up in MtrrLibCalculateMtrrs() already
> guarantees that Length can not be zero at this point.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 17 +
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c 
> b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> index e5c862c83d61..dd0b668d7782 100644
> --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> @@ -1253,21 +1253,6 @@ MtrrLibLowestType (
>return (MTRR_MEMORY_CACHE_TYPE)Type;
>  }
> 
> -/**
> -  Return TRUE when the Operand is exactly power of 2.
> -
> -  @retval TRUE  Operand is exactly power of 2.
> -  @retval FALSE Operand is not power of 2.
> -**/
> -BOOLEAN
> -MtrrLibIsPowerOfTwo (
> -  IN UINT64  Operand
> -  )
> -{
> -  ASSERT (Operand != 0);
> -  return (BOOLEAN)((Operand & (Operand - 1)) == 0);
> -}
> -
>  /**
>Calculate the subtractive path from vertex Start to Stop.
> 
> @@ -1638,7 +1623,7 @@ MtrrLibCalculateMtrrs (
>break;
>  }
> 
> -if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && MtrrLibIsPowerOfTwo 
> (Length)) {
> +if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && IS_POW2 (Length)) {
>if (MtrrLibGetNumberOfTypes (
>  Ranges,
>  RangeCount,
> --
> 2.39.2
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101594): https://edk2.groups.io/g/devel/message/101594
Mute This Topic: https://groups.io/mt/97773225/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 2/2] MdePkg: Update code to be more C11 compliant by using __func__

2023-03-22 Thread Rebecca Cran

Can we not require that VS2015 Update 3 is installed?

Do people have reasons to be running older builds, or is it just that 
they forget to install the updates?



--
Rebecca Cran


On 3/22/23 10:58 AM, Kinney, Michael D wrote:

Hi Rebecca,

It appears that some of the older release of VS2015 do not support
__func__.

Can you please work on a patch that implements the workaround?

Thanks,

Mike


-Original Message-
From: Kinney, Michael D 
Sent: Friday, March 17, 2023 8:16 AM
To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming ; 
Liu, Zhiguang ;
Michael Kubacki ; Sean Brogan 

Cc: Kinney, Michael D 
Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
compliant by using __func__

Hi Rebecca,

For older compilers that do not support __func__, I believe a workaround
could be added to define __func__ to __FUNCTION__.  We do not need to do
this for any of these patches.  It can be something consumers can do if
they really want to use an older compiler.

You can try it out on VS2012 locally.  If it works, then you can mention
that workaround in the commit message.

Do we have any information on GCC/CLANG compatibility for this feature?

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Friday, March 17, 2023 6:32 AM
To: Kinney, Michael D ; devel@edk2.groups.io; Gao, Liming 
; Liu, Zhiguang
; Michael Kubacki ; Sean Brogan 

Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
compliant by using __func__

(+Michael Kubacki, Sean Brogan)

Mike, Michael, Sean:


This change is going to break building edk2 with anything older than
Visual Studio 2015, which is where support for __func__ was added.

I checked and currently it appears that VS2013 builds edk2 but VS2012
has errors. Given that the stuart tools don't support anything older
than VS2017 I'm thinking this is okay, but I want to double check before
pushing this change.


--

Rebecca Cran


On 3/14/23 2:40 PM, Kinney, Michael D wrote:

Reviewed-by: Michael D Kinney 



-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Monday, March 13, 2023 7:20 PM
To: devel@edk2.groups.io; Kinney, Michael D ; Gao, Liming 
;
Liu, Zhiguang 
Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
compliant by using __func__

Mike,


I think your concerns with this patch were addressed?

Could you add a Reviewed-by please?


Thanks.
Rebecca


On 2/9/23 6:01 PM, Michael D Kinney wrote:

Hi Rebecca,

Did this pass EDK II CI?

This change does break EBC compiler builds.  The following has to be added to
MdePkg/Include/Ebc/ProcessorBind.h in order to use __func__ everywhere.

   #define __func__ __FUNCTION__

I also see __FUNCTION__ used in many packages.  I am wondering if we want
to do this clean up if it should be its own patch series and update all
packages in once series.

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Thursday, February 9, 2023 7:45 AM
To: devel@edk2.groups.io; Kinney, Michael D ; Gao, Liming 
;

Liu, Zhiguang


Cc: Rebecca Cran 
Subject: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 compliant 
by using __func__

__FUNCTION__ is a pre-standard extension that gcc and Visual C++ among
others support, while __func__ was standardized in C99.

Since it's more standard, replace __FUNCTION__ with __func__ throughout
MdePkg.

Signed-off-by: Rebecca Cran 
---
MdePkg/Include/Library/PerformanceLib.h 
   | 12 ++--
MdePkg/Include/Library/UnitTestLib.h
   | 18 +--

---

MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c 
   |  6 +++---
MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c 
   | 12 ++--
MdePkg/Library/BaseLib/SafeString.c 
   |  2 +-

MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
 |  4 ++--
MdePkg/Library/DxeRngLib/DxeRngLib.c
   | 14 +++---
7 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/MdePkg/Include/Library/PerformanceLib.h 
b/MdePkg/Include/Library/PerformanceLib.h
index 34ec956b9c0e..d0f2dfb070d5 100644
--- a/MdePkg/Include/Library/PerformanceLib.h
+++ b/MdePkg/Include/Library/PerformanceLib.h
@@ -526,7 +526,7 @@ LogPerformanceMeasurement (
#define PERF_EVENT_SIGNAL_BEGIN(EventGuid) \
  do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
-  LogPerformanceMeasurement (, EventGuid, __FUNCTION__ , 
0, PERF_EVENTSIGNAL_START_ID); \
+  LogPerformanceMeasurement (, EventGuid, __func__ , 0, 
PERF_EVENTSIGNAL_START_ID); \
} \
  } while (FALSE)

@@ -542,7 +542,7 @@ LogPerformanceMeasurement (
  

Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 compliant by using __func__

2023-03-22 Thread Michael D Kinney
Hi Rebecca,

It appears that some of the older release of VS2015 do not support
__func__.

Can you please work on a patch that implements the workaround?

Thanks,

Mike

> -Original Message-
> From: Kinney, Michael D 
> Sent: Friday, March 17, 2023 8:16 AM
> To: devel@edk2.groups.io; rebe...@bsdio.com; Gao, Liming 
> ; Liu, Zhiguang ;
> Michael Kubacki ; Sean Brogan 
> 
> Cc: Kinney, Michael D 
> Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> compliant by using __func__
> 
> Hi Rebecca,
> 
> For older compilers that do not support __func__, I believe a workaround
> could be added to define __func__ to __FUNCTION__.  We do not need to do
> this for any of these patches.  It can be something consumers can do if
> they really want to use an older compiler.
> 
> You can try it out on VS2012 locally.  If it works, then you can mention
> that workaround in the commit message.
> 
> Do we have any information on GCC/CLANG compatibility for this feature?
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
> > Sent: Friday, March 17, 2023 6:32 AM
> > To: Kinney, Michael D ; devel@edk2.groups.io; 
> > Gao, Liming ; Liu, Zhiguang
> > ; Michael Kubacki ; 
> > Sean Brogan 
> > Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> > compliant by using __func__
> >
> > (+Michael Kubacki, Sean Brogan)
> >
> > Mike, Michael, Sean:
> >
> >
> > This change is going to break building edk2 with anything older than
> > Visual Studio 2015, which is where support for __func__ was added.
> >
> > I checked and currently it appears that VS2013 builds edk2 but VS2012
> > has errors. Given that the stuart tools don't support anything older
> > than VS2017 I'm thinking this is okay, but I want to double check before
> > pushing this change.
> >
> >
> > --
> >
> > Rebecca Cran
> >
> >
> > On 3/14/23 2:40 PM, Kinney, Michael D wrote:
> > > Reviewed-by: Michael D Kinney 
> > >
> > >
> > >> -Original Message-
> > >> From: devel@edk2.groups.io  On Behalf Of Rebecca 
> > >> Cran
> > >> Sent: Monday, March 13, 2023 7:20 PM
> > >> To: devel@edk2.groups.io; Kinney, Michael D 
> > >> ; Gao, Liming ;
> > >> Liu, Zhiguang 
> > >> Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> > >> compliant by using __func__
> > >>
> > >> Mike,
> > >>
> > >>
> > >> I think your concerns with this patch were addressed?
> > >>
> > >> Could you add a Reviewed-by please?
> > >>
> > >>
> > >> Thanks.
> > >> Rebecca
> > >>
> > >>
> > >> On 2/9/23 6:01 PM, Michael D Kinney wrote:
> > >>> Hi Rebecca,
> > >>>
> > >>> Did this pass EDK II CI?
> > >>>
> > >>> This change does break EBC compiler builds.  The following has to be 
> > >>> added to
> > >>> MdePkg/Include/Ebc/ProcessorBind.h in order to use __func__ everywhere.
> > >>>
> > >>>   #define __func__ __FUNCTION__
> > >>>
> > >>> I also see __FUNCTION__ used in many packages.  I am wondering if we 
> > >>> want
> > >>> to do this clean up if it should be its own patch series and update all
> > >>> packages in once series.
> > >>>
> > >>> Mike
> > >>>
> >  -Original Message-
> >  From: devel@edk2.groups.io  On Behalf Of Rebecca 
> >  Cran
> >  Sent: Thursday, February 9, 2023 7:45 AM
> >  To: devel@edk2.groups.io; Kinney, Michael D 
> >  ; Gao, Liming ;
> > >> Liu, Zhiguang
> >  
> >  Cc: Rebecca Cran 
> >  Subject: [edk2-devel] [PATCH 2/2] MdePkg: Update code to be more C11 
> >  compliant by using __func__
> > 
> >  __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among
> >  others support, while __func__ was standardized in C99.
> > 
> >  Since it's more standard, replace __FUNCTION__ with __func__ throughout
> >  MdePkg.
> > 
> >  Signed-off-by: Rebecca Cran 
> >  ---
> > MdePkg/Include/Library/PerformanceLib.h 
> > | 12 ++--
> > MdePkg/Include/Library/UnitTestLib.h
> > | 18 +--
> > >> ---
> > MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c 
> > |  6 +++---
> > MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c 
> > | 12 ++--
> > MdePkg/Library/BaseLib/SafeString.c 
> > |  2 +-
> > 
> >  MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> >   |  4 ++--
> > MdePkg/Library/DxeRngLib/DxeRngLib.c
> > | 14 +++---
> > 7 files changed, 34 insertions(+), 34 deletions(-)
> > 
> >  diff --git a/MdePkg/Include/Library/PerformanceLib.h 
> >  b/MdePkg/Include/Library/PerformanceLib.h
> >  index 

Re: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-22 Thread Oliver Smith-Denny

Thanks for the cleanup!

Reviewed-by: Oliver Smith-Denny 

On 3/21/2023 6:30 PM, Rebecca Cran wrote:

Update the toolchain definitions:

- Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
   CLANGDWARF, updating it to support ARM and AARCH64 in addition to X64
and IA32.

- Remove VS2008, VS2010, VS2012 and VS2013.

- Remove EBC compiler definitions. Full removal of EBC support from the
   various packages etc. will be done in a follow-up patch series.

- Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS definitions.

Personal GitHub PR: https://github.com/tianocore/edk2/pull/4158
GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf

Rebecca Cran (9):
   OvmfPkg: Replace static struct initialization with ZeroMem call
   CryptoPkg: Add CLANGDWARF and remove CLANG35 and CLANG38 compiler
 flags
   BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38
   BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
   BaseTools: Remove VS2008-VS2013 remnants
   MdePkg: Remove VS2008-VS2013 remnants
   edksetup.bat: Remove VS2008-VS2013 remnants
   BaseTools: Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS defs
   BaseTools: Remove EBC (EFI Byte Code) compiler definitions

  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf |3 +-
  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  |3 +-
  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  |3 +-
  CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  |3 +-
  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  |3 +-
  CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf |3 +-
  CryptoPkg/Library/OpensslLib/OpensslLib.inf |3 +-
  CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf|3 +-
  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   |3 +-
  CryptoPkg/Library/OpensslLib/OpensslLibFull.inf |3 +-
  CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf|3 +-
  MdePkg/Include/Ia32/ProcessorBind.h |8 +-
  MdePkg/Include/X64/ProcessorBind.h  |8 +-
  OvmfPkg/Library/PlatformInitLib/MemDetect.c |4 +-
  BaseTools/Conf/tools_def.template   | 1572 
+++-
  BaseTools/Scripts/SetVisualStudio.bat   |   22 +-
  BaseTools/Scripts/ShowEnvironment.bat   |   44 -
  BaseTools/get_vsvars.bat|   13 -
  BaseTools/set_vsprefix_envs.bat |   64 -
  BaseTools/toolsetup.bat |   24 +-
  edksetup.bat|6 +-
  21 files changed, 192 insertions(+), 1606 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101590): https://edk2.groups.io/g/devel/message/101590
Mute This Topic: https://groups.io/mt/97769541/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] OvmfPkg/PlatformBootManagerLib: use utf8 for the serial console.

2023-03-22 Thread Rebecca Cran

On 3/22/23 10:20 AM, Ard Biesheuvel wrote:

On Fri, 17 Mar 2023 at 13:19, Gerd Hoffmann  wrote:

Time to leave behind relics from the last century and arrive in the
modern world.  Drop PC-ANSI Terminal Type for the serial console, use
UTF-8 instead.

Signed-off-by: Gerd Hoffmann 

No objections here but how will I be able to observe the difference?


I'm not sure if it's as simple as this or if it depends on the terminal, 
TERM setting etc., but I saw a difference when I opened the UiApp and 
opened the drop-down "Select Language".


Before the patch, it showed "Fran?ais", and after, "Français".


--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101589): https://edk2.groups.io/g/devel/message/101589
Mute This Topic: https://groups.io/mt/97671520/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] OvmfPkg/PlatformBootManagerLib: use utf8 for the serial console.

2023-03-22 Thread Ard Biesheuvel
On Fri, 17 Mar 2023 at 13:19, Gerd Hoffmann  wrote:
>
> Time to leave behind relics from the last century and arrive in the
> modern world.  Drop PC-ANSI Terminal Type for the serial console, use
> UTF-8 instead.
>
> Signed-off-by: Gerd Hoffmann 

No objections here but how will I be able to observe the difference?

> ---
>  OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h  | 4 ++--
>  OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h 
> b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
> index 1676d61616d8..18b3deb9db59 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
> @@ -126,7 +126,7 @@ extern VENDOR_DEVICE_PATHgTerminalTypeDeviceNode;
>  1 \
>}
>
> -#define gPcAnsiTerminal \
> +#define gVtUtf8Terminal \
>{ \
>  { \
>MESSAGING_DEVICE_PATH, \
> @@ -136,7 +136,7 @@ extern VENDOR_DEVICE_PATHgTerminalTypeDeviceNode;
>  (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
>} \
>  }, \
> -DEVICE_PATH_MESSAGING_PC_ANSI \
> +DEVICE_PATH_MESSAGING_VT_UTF8 \
>}
>
>  #define gEndEntire \
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c 
> b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> index 6536d9fe369e..c1801725c2c8 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c
> @@ -47,7 +47,7 @@ typedef struct {
>  ACPI_HID_DEVICE_PATH  gPnpPs2KeyboardDeviceNode  = gPnpPs2Keyboard;
>  ACPI_HID_DEVICE_PATH  gPnp16550ComPortDeviceNode = gPnp16550ComPort;
>  UART_DEVICE_PATH  gUartDeviceNode= gUart;
> -VENDOR_DEVICE_PATHgTerminalTypeDeviceNode= gPcAnsiTerminal;
> +VENDOR_DEVICE_PATHgTerminalTypeDeviceNode= gVtUtf8Terminal;
>
>  //
>  // Platform specific keyboard device path
> @@ -83,7 +83,7 @@ VENDOR_UART_DEVICE_PATH  gDebugAgentUartDevicePath = {
>  0,  // Parity   - Default
>  0,  // StopBits - Default
>},
> -  gPcAnsiTerminal,
> +  gVtUtf8Terminal,
>gEndEntire
>  };
>
> @@ -168,7 +168,7 @@ STATIC VENDOR_UART_DEVICE_PATH  gXenConsoleDevicePath = {
>  FixedPcdGet8 (PcdUartDefaultParity),
>  FixedPcdGet8 (PcdUartDefaultStopBits),
>},
> -  gPcAnsiTerminal,
> +  gVtUtf8Terminal,
>gEndEntire
>  };
>
> --
> 2.39.2
>
>
>
> 
>
>


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




Re: [edk2-devel] [Patch 0/2] Add and use FirmwareVolumeShadowPpi

2023-03-22 Thread Oliver Smith-Denny

For the patchset:

Reviewed-by: Oliver Smith-Denny 

Thanks!

On 3/21/2023 7:06 PM, Michael D Kinney wrote:

Add FirmwareVolumeShadow PPI to shadow an FV to memory.
and use it to shadow FVs to memory.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Patel Umang 

Umang Patel (2):
   MdeModulePkg/Include/Ppi: Add FirmwareVolumeShadowPpi
   SecurityPkg/FvReportPei: Use FirmwareVolumeShadowPpi

  .../Include/Ppi/FirmwareVolumeShadowPpi.h | 61 +++
  MdeModulePkg/MdeModulePkg.dec |  3 +
  SecurityPkg/FvReportPei/FvReportPei.c | 37 ---
  SecurityPkg/FvReportPei/FvReportPei.h |  1 +
  SecurityPkg/FvReportPei/FvReportPei.inf   |  1 +
  5 files changed, 96 insertions(+), 7 deletions(-)
  create mode 100644 MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h




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




Re: [edk2-devel] [Patch 2/2] SecurityPkg/FvReportPei: Use FirmwareVolumeShadowPpi

2023-03-22 Thread Oliver Smith-Denny

One comment below, thanks!

On 3/21/2023 7:06 PM, Michael D Kinney wrote:

From: Umang Patel 

If FirmwareVolumeShadow PPI is available, then use it to
shadow FVs to memory.  Otherwise fallback to CopyMem().

Cc: Jiewen Yao 
Cc: Jian J Wang 
Signed-off-by: Patel Umang 
---
  SecurityPkg/FvReportPei/FvReportPei.c   | 37 -
  SecurityPkg/FvReportPei/FvReportPei.h   |  1 +
  SecurityPkg/FvReportPei/FvReportPei.inf |  1 +
  3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/SecurityPkg/FvReportPei/FvReportPei.c 
b/SecurityPkg/FvReportPei/FvReportPei.c
index 846605cda1e4..6288dde16b2a 100644
--- a/SecurityPkg/FvReportPei/FvReportPei.c
+++ b/SecurityPkg/FvReportPei/FvReportPei.c
@@ -114,12 +114,13 @@ VerifyHashedFv (
IN EFI_BOOT_MODE   BootMode
)
  {
-  UINTNFvIndex;
-  CONST HASH_ALG_INFO  *AlgInfo;
-  UINT8*HashValue;
-  UINT8*FvHashValue;
-  VOID *FvBuffer;
-  EFI_STATUS   Status;
+  UINTN FvIndex;
+  CONST HASH_ALG_INFO   *AlgInfo;
+  UINT8 *HashValue;
+  UINT8 *FvHashValue;
+  VOID  *FvBuffer;
+  EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI  *FvShadowPpi;
+  EFI_STATUSStatus;
  
if ((HashInfo == NULL) ||

(HashInfo->HashSize == 0) ||
@@ -191,8 +192,30 @@ VerifyHashedFv (
  // Copy FV to permanent memory to avoid potential TOC/TOU.
  //
  FvBuffer = AllocatePages (EFI_SIZE_TO_PAGES 
((UINTN)FvInfo[FvIndex].Length));
+
  ASSERT (FvBuffer != NULL);


While we are here, should we make this more robust (and amenable to 
static analysis) and add error handling if FvBuffer is NULL, not just 
assert?



-CopyMem (FvBuffer, (CONST VOID *)(UINTN)FvInfo[FvIndex].Base, 
(UINTN)FvInfo[FvIndex].Length);
+Status = PeiServicesLocatePpi (
+   ,
+   0,
+   NULL,
+   (VOID **)
+   );
+
+if (!EFI_ERROR (Status)) {
+  Status = FvShadowPpi->FirmwareVolumeShadow (
+  (EFI_PHYSICAL_ADDRESS)FvInfo[FvIndex].Base,
+  FvBuffer,
+  (UINTN)FvInfo[FvIndex].Length
+  );
+}
+
+if (EFI_ERROR (Status)) {
+  CopyMem (
+FvBuffer,
+(CONST VOID *)(UINTN)FvInfo[FvIndex].Base,
+(UINTN)FvInfo[FvIndex].Length
+);
+}
  
  if (!AlgInfo->HashAll (FvBuffer, (UINTN)FvInfo[FvIndex].Length, FvHashValue)) {

Status = EFI_ABORTED;
diff --git a/SecurityPkg/FvReportPei/FvReportPei.h 
b/SecurityPkg/FvReportPei/FvReportPei.h
index 92504a3c51e1..07ffb2f5768c 100644
--- a/SecurityPkg/FvReportPei/FvReportPei.h
+++ b/SecurityPkg/FvReportPei/FvReportPei.h
@@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
  #include 
  
  #include 

+#include 
  
  #include 

  #include 
diff --git a/SecurityPkg/FvReportPei/FvReportPei.inf 
b/SecurityPkg/FvReportPei/FvReportPei.inf
index 408406889765..4246fb75ebaa 100644
--- a/SecurityPkg/FvReportPei/FvReportPei.inf
+++ b/SecurityPkg/FvReportPei/FvReportPei.inf
@@ -46,6 +46,7 @@ [LibraryClasses]
  [Ppis]
gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid   ## PRODUCES
gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid  ## CONSUMES
+  gEdkiiPeiFirmwareVolumeShadowPpiGuid## CONSUMES
  
  [Pcd]

gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeFvVerificationPass



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101586): https://edk2.groups.io/g/devel/message/101586
Mute This Topic: https://groups.io/mt/97770069/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 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if present

2023-03-22 Thread Yao, Jiewen
Question: Why not uninstall it in the universal payload package? or even not 
populate it?


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Subash
> Lakkimsetti
> Sent: Wednesday, March 22, 2023 1:59 PM
> To: devel@edk2.groups.io
> Cc: Lakkimsetti, Subash ; Zhang, Qi1
> ; Kumar, Rahul R 
> Subject: [edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if
> present
> 
> From: Subash Lakkimsetti 
> 
> Bootloader supports multiple payload and TPM2 ACPI tables are updated
> at bootloader phase. When UEFI is used payload these will be duplicates.
> The tables are to be uninstalled before updating the TCG2ACPI tables
> to avoid duplicates.
> 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Signed-off-by: Subash Lakkimsetti 
> ---
>  SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c   | 251
> ++
>  SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf |   3 +
>  2 files changed, 254 insertions(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> index e8822cbeb0..4b35796ba7 100644
> --- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> +++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
> @@ -39,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
> 
>  #include 
> 
>  #include 
> 
> +#include 
> 
> +#include 
> 
> 
> 
>  //
> 
>  // Physical Presence Interface Version supported by Platform
> 
> @@ -867,6 +869,245 @@ PublishTpm2 (
>return Status;
> 
>  }
> 
> 
> 
> +/**
> 
> +  Uninstall TPM2 SSDT ACPI table
> 
> +
> 
> +  This performs uninstallation of TPM2 SSDT tables published by
> 
> +  bootloaders.
> 
> +
> 
> +  @retval   EFI_SUCCESS The TPM2 ACPI table is uninstalled successfully 
> if
> found.
> 
> +  @retval   Others  Operation error.
> 
> +
> 
> +**/
> 
> +EFI_STATUS
> 
> +UnInstallTpm2SSDTAcpiTables (
> 
> +  )
> 
> +{
> 
> +  UINTNTableIndex;
> 
> +  UINTNTableKey;
> 
> +  EFI_ACPI_TABLE_VERSION   TableVersion;
> 
> +  VOID *TableHeader;
> 
> +  EFI_STATUS   Status;
> 
> +  EFI_ACPI_SDT_PROTOCOL*mAcpiSdtProtocol;
> 
> +  EFI_ACPI_TABLE_PROTOCOL  *mAcpiTableProtocol;
> 
> +  CHAR8TableIdString[8];
> 
> +  UINT64   TableIdSignature;
> 
> +
> 
> +  //
> 
> +  // Determine whether there is a TPM2 SSDT already in the ACPI table.
> 
> +  //
> 
> +  Status = EFI_SUCCESS;
> 
> +  TableIndex = 0;
> 
> +  TableKey   = 0;
> 
> +  TableHeader= NULL;
> 
> +  mAcpiTableProtocol = NULL;
> 
> +  mAcpiSdtProtocol   = NULL;
> 
> +
> 
> +  //
> 
> +  // Locate the EFI_ACPI_TABLE_PROTOCOL.
> 
> +  //
> 
> +  Status = gBS->LocateProtocol (
> 
> +  ,
> 
> +  NULL,
> 
> +  (VOID **)
> 
> +  );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +DEBUG ((
> 
> +  DEBUG_INFO,
> 
> +  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Table
> Protocol \n "
> 
> +  ));
> 
> +return Status;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // Locate the EFI_ACPI_SDT_PROTOCOL.
> 
> +  //
> 
> +  Status = gBS->LocateProtocol (
> 
> +  ,
> 
> +  NULL,
> 
> +  (VOID **)
> 
> +  );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +DEBUG ((
> 
> +  DEBUG_INFO,
> 
> +  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Sdt Protocol,
> "
> 
> +  "\n"
> 
> +  ));
> 
> +return Status;
> 
> +  }
> 
> +
> 
> +  while (!EFI_ERROR (Status)) {
> 
> +Status = mAcpiSdtProtocol->GetAcpiTable (
> 
> + TableIndex,
> 
> + (EFI_ACPI_SDT_HEADER **),
> 
> + ,
> 
> + 
> 
> + );
> 
> +
> 
> +if (!EFI_ERROR (Status)) {
> 
> +  TableIndex++;
> 
> +
> 
> +  if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature ==
> SIGNATURE_32 ('S', 'S', 'D', 'T')) {
> 
> +CopyMem ((VOID *)TableIdString, (VOID *)((EFI_ACPI_SDT_HEADER
> *)TableHeader)->OemTableId, sizeof (TableIdString));
> 
> +
> 
> +TableIdSignature = SIGNATURE_64 (
> 
> + TableIdString[0],
> 
> + TableIdString[1],
> 
> + TableIdString[2],
> 
> + TableIdString[3],
> 
> + TableIdString[4],
> 
> + TableIdString[5],
> 
> + TableIdString[6],
> 
> + TableIdString[7]
> 
> + );
> 
> +
> 
> +if (TableIdSignature == SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 
> 'b', 'l')) {
> 
> +  DEBUG ((DEBUG_INFO, "Found Tpm2 SSDT Table for Physical
> Presence\n"));
> 
> +  break;
> 
> +}
> 
> +  }
> 
> +}
> 
> +  }
> 
> +
> 
> +  if (!EFI_ERROR (Status)) {
> 
> +//
> 
> +// A TPM2 

[edk2-devel] [PATCH v1 2/6] UefiPayloadPkg: Add secureboot information HOBs

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

This patch add the HOB fpr secure and measured boot
information. This is populated by bootloader phase
and uefipayload pkg uses this info to sync the TPM
info PCDs.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Subash Lakkimsetti 
---
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c   | 77 +++-
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf | 13 +++-
 UefiPayloadPkg/UefiPayloadPkg.dec|  4 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc|  2 +
 4 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c 
b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
index 2e70c4533c..7415507ec6 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
@@ -2,11 +2,14 @@
   This driver will report some MMIO/IO resources to dxe core, extract smbios 
and acpi
   tables from bootloader.
 
-  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2023, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 #include "BlSupportDxe.h"
+#include 
+#include 
+#include 
 
 /**
   Reserve MMIO/IO resource in GCD
@@ -86,6 +89,73 @@ ReserveResourceInGcd (
   return Status;
 }
 
+/**
+Sync the Secure boot hob info and TPM PCD as per the information passed from 
Bootloader.
+**/
+EFI_STATUS
+BlSupportSecurityPcdSync (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+  EFI_HOB_GUID_TYPE   *GuidHob;
+  UNIVERSAL_SECURE_BOOT_INFO  *SecurebootInfoHob;
+  UINTN   Size;
+
+  GuidHob = GetFirstGuidHob ();
+  if (GuidHob == NULL) {
+DEBUG ((DEBUG_ERROR, "gUniversalPayloadSecureBootInfoGuid Not Found!\n"));
+return EFI_UNSUPPORTED;
+  }
+
+  SecurebootInfoHob = (UNIVERSAL_SECURE_BOOT_INFO *)GET_GUID_HOB_DATA 
(GuidHob);
+
+  // Sync the Hash mask for TPM 2.0 as per active PCR banks.
+  // Make sure that the current PCR allocations, the TPM supported PCRs,
+  // and the PcdTpm2HashMask are all in agreement.
+  Status = PcdSet32S (PcdTpm2HashMask, 
SecurebootInfoHob->TpmPcrActivePcrBanks);
+  ASSERT_EFI_ERROR (Status);
+  DEBUG ((DEBUG_INFO, "TpmPcrActivePcrBanks 0x%x \n", 
SecurebootInfoHob->TpmPcrActivePcrBanks));
+
+  // Set the Firmware debugger PCD
+  Status = PcdSetBoolS (PcdFirmwareDebuggerInitialized, 
SecurebootInfoHob->FirmwareDebuggerInitialized);
+  ASSERT_EFI_ERROR (Status);
+  DEBUG ((DEBUG_INFO, " FirmwareDebugger Initialized 0x%x \n", 
SecurebootInfoHob->FirmwareDebuggerInitialized));
+
+  // Set the TPM Type instance GUID
+  if (SecurebootInfoHob->MeasuredBootEnabled) {
+if (SecurebootInfoHob->TpmType == TPM_TYPE_20) {
+  DEBUG ((DEBUG_INFO, "%a: TPM2 detected\n", __FUNCTION__));
+  Size   = sizeof (gEfiTpmDeviceInstanceTpm20DtpmGuid);
+  Status = PcdSetPtrS (
+ PcdTpmInstanceGuid,
+ ,
+ 
+ );
+} else if (SecurebootInfoHob->TpmType == TPM_TYPE_12) {
+  DEBUG ((DEBUG_INFO, "%a: TPM1.2 detected\n", __FUNCTION__));
+  Size   = sizeof (gEfiTpmDeviceInstanceTpm12Guid);
+  Status = PcdSetPtrS (
+ PcdTpmInstanceGuid,
+ ,
+ 
+ );
+} else {
+  DEBUG ((DEBUG_INFO, "%a: No TPM detected\n", __FUNCTION__));
+  Size   = sizeof (gEfiTpmDeviceInstanceNoneGuid);
+  Status = PcdSetPtrS (
+ PcdTpmInstanceGuid,
+ ,
+ 
+ );
+}
+
+ASSERT_EFI_ERROR (Status);
+  }
+
+  return Status;
+}
+
 /**
   Main entry for the bootloader support DXE module.
 
@@ -144,5 +214,10 @@ BlDxeEntryPoint (
 ASSERT_EFI_ERROR (Status);
   }
 
+  //
+  // Sync Bootloader info for TPM
+  //
+  BlSupportSecurityPcdSync ();
+
   return EFI_SUCCESS;
 }
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf 
b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
index 96d85d2b1d..162167e6bb 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
@@ -3,7 +3,7 @@
 #
 # Report some MMIO/IO resources to dxe core, extract smbios and acpi tables
 #
-#  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2014 - 2023, Intel Corporation. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -30,6 +30,7 @@
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
+  SecurityPkg/SecurityPkg.dec
   UefiPayloadPkg/UefiPayloadPkg.dec
 
 [LibraryClasses]
@@ -44,6 +45,10 @@
 [Guids]
   gUefiAcpiBoardInfoGuid
   gEfiGraphicsInfoHobGuid
+  gUniversalPayloadSecureBootInfoGuid
+  gEfiTpmDeviceInstanceTpm20DtpmGuid
+  gEfiTpmDeviceInstanceTpm12Guid
+  gEfiTpmDeviceInstanceNoneGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
@@ -52,6 +57,10 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution
   

[edk2-devel] [PATCH v1 6/6] UefiPayloadPkg: Add secure boot definitions to ci build

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Define the build flags for secure boot and measure boot
for ci builds

Signed-off-by: Subash Lakkimsetti 
---
 UefiPayloadPkg/UefiPayloadPkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.ci.yaml 
b/UefiPayloadPkg/UefiPayloadPkg.ci.yaml
index 909379eaac..f2410a8b11 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.ci.yaml
+++ b/UefiPayloadPkg/UefiPayloadPkg.ci.yaml
@@ -91,5 +91,9 @@
 "BLD_*_EMU_VARIABLE_ENABLE": "FALSE",
 "BLD_*_DISABLE_RESET_SYSTEM": "TRUE",
 "BLD_*_SERIAL_DRIVER_ENABLE": "FALSE",
+"BLD_*_SMM_SUPPORT": "TRUE",
+"BLD_*_SECURE_BOOT_ENABLE": "TRUE",
+"BLD_*_MEASURED_BOOT_ENABLE": "TRUE",
+"BLD_*_VARIABLE_SUPPORT": "SPI",
 }
 }
-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds AMD/BoardPkg and AMD/PlatformPkg maintainers

2023-03-22 Thread Attar, AbdulLateef (Abdul Lateef) via groups.io
[Public]

Hi Abner,
That's right, Platform/AMD/MinBoardPkg will contains all 
modules/library/drivers required for AMD boards which are based on 
MinPlatformPkg framework.
Thanks
AbduL

-Original Message-
From: Chang, Abner 
Sent: 22 March 2023 15:25
To: Attar, AbdulLateef (Abdul Lateef) ; Leif 
Lindholm 
Cc: devel@edk2.groups.io; Ard Biesheuvel ; Michael D 
Kinney 
Subject: RE: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds 
AMD/BoardPkg and AMD/PlatformPkg maintainers

[AMD Official Use Only - General]



> -Original Message-
> From: Attar, AbdulLateef (Abdul Lateef) 
> Sent: Tuesday, March 21, 2023 11:01 AM
> To: Leif Lindholm 
> Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> Biesheuvel ; Michael D Kinney
> 
> Subject: RE: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> AMD/BoardPkg and AMD/PlatformPkg maintainers
>
> [AMD Official Use Only - General]
>
> Hi Leif,
> AMD/BoardPkg will implements modules specific to boards(one or
> more motherboards).
> It will not contain any module specific to Platform or Silicon, which
> are part of MinPlatformPkg.
>
> How about just Min prefix?
> AMD/MinBoardPkg (I am avoiding the Amd prefix because its already in
> AMD folder).
I am good with this naming. So we will have AMD boards that leverage 
MinPlatform under MinBoardPkg. Those boards which are not Minplatform based can 
just stay under Platforms/AMD (e.g., OverdriveBoard.), is my understanding 
correct Abdul?
Abner
>
> AMD board package for MinPlatformPkg
>  F: Platform/AMD/MinBoardPkg
>  M: Maintainer1
>  M: Maintainer2
>
> Thanks
> AbduL
>
> -Original Message-
> From: Leif Lindholm 
> Sent: 20 March 2023 23:33
> To: Attar, AbdulLateef (Abdul Lateef) 
> Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> Biesheuvel ; Michael D Kinney
> 
> Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> AMD/BoardPkg and AMD/PlatformPkg maintainers
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Hi Abdul,
>
> On Mon, Mar 20, 2023 at 14:09:11 +, Attar, AbdulLateef (Abdul
> Lateef)
> wrote:
> > AMD/BoardPkg will contains the modules/drivers to support
> MinPlatformPkg framework.
> >BoardPkg will be generic across all AMD boards which are based on
> MinPlatformPkg framework.
> >It's like "edk2-platforms/Platform/Qemu/QemuOpenBoardPkg".
> >We will gradually add modules and libraries to it.
>
> So, if the purpose is exclusively to support MinPlatformPkg platforms,
> I think that should be part of the name.
> Like Platform/AMD/AmdMinPlatformPkg (for example).
>
> > AMD/PlatformPkg will contain the modules/drivers which are generic
> > to
> future AMD platform.
> >Currently we don't have complete platform, we can drop
> >PlatformPkg for now till we have complete(reasonable modules)
> >solution.
>
> It will certainly be easier to reason about what the preferred
> naming/layout should be once there is code to look at for examples.
> It may be that parts of it would live more naturally under
> Silicon/AMD, for example.
>
> > It's better to not touch existing AMD/OverdriveBoard, restructuring
> > requires changes to .dsc and .fdf files, might break backward
> > compatibility.
>
> No problem. Config files occasionally need to be revamped, but that's
> simply a mechanical exercise.
>
> > How about having just BoardPkg like below?
>
> That, too, is a completely generic name that conveys no information
> about
> *what* boards one can expect to find in there.
>
> Regards,
>
> Leif
>
> > AMD board package
> > F: Platform/AMD/BoardPkg
> > M: Maintainer1
> > M: Maintainer2
> >
> > Please let me know your thoughts.
> >
> > Thanks
> > AbduL
> >
> >
> >
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: 20 March 2023 18:35
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Attar, AbdulLateef (Abdul Lateef) ;
> > Ard Biesheuvel ; Michael D Kinney
> > 
> > Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt:
> > Adds AMD/BoardPkg and AMD/PlatformPkg maintainers
> >
> > Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abner,
> >
> > On Sat, Mar 18, 2023 at 09:16:17 +, Chang, Abner via groups.io wrote:
> > > I don't see any modules under OverdriveBoard, is this package
> > > still
> >
> > The code is split between Platform/AMD and Silicon/AMD/Styx, the
> > latter
> also being used by SoftIron/Overdrive1000 and LeMaker Cello (although
> that one is pretty much defunct and should probably be dropped).
> >
> > > in use? Do you still remember where is FDF and DSC come from (as
> > > there is AMD copyright 2014-2016) back to the moment when you was
> > > introduced this package?
> >
> > As the git history tells you:
> > ---
> > commit f4d38e50c0f24eb78eb003a94f583025621c63db
> > Author: Leif Lindholm 
> > Date:   Thu Aug 

[edk2-devel] [PATCH v1 3/6] TGC2ACPI: Uninstall the TPM2 ACPI if present

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Bootloader supports multiple payload and TPM2 ACPI tables are updated
at bootloader phase. When UEFI is used payload these will be duplicates.
The tables are to be uninstalled before updating the TCG2ACPI tables
to avoid duplicates.

Cc: Qi Zhang 
Cc: Rahul Kumar 
Signed-off-by: Subash Lakkimsetti 
---
 SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c   | 251 ++
 SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf |   3 +
 2 files changed, 254 insertions(+)

diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c 
b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
index e8822cbeb0..4b35796ba7 100644
--- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
+++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
@@ -39,6 +39,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
+#include 
 
 //
 // Physical Presence Interface Version supported by Platform
@@ -867,6 +869,245 @@ PublishTpm2 (
   return Status;
 }
 
+/**
+  Uninstall TPM2 SSDT ACPI table
+
+  This performs uninstallation of TPM2 SSDT tables published by
+  bootloaders.
+
+  @retval   EFI_SUCCESS The TPM2 ACPI table is uninstalled successfully if 
found.
+  @retval   Others  Operation error.
+
+**/
+EFI_STATUS
+UnInstallTpm2SSDTAcpiTables (
+  )
+{
+  UINTNTableIndex;
+  UINTNTableKey;
+  EFI_ACPI_TABLE_VERSION   TableVersion;
+  VOID *TableHeader;
+  EFI_STATUS   Status;
+  EFI_ACPI_SDT_PROTOCOL*mAcpiSdtProtocol;
+  EFI_ACPI_TABLE_PROTOCOL  *mAcpiTableProtocol;
+  CHAR8TableIdString[8];
+  UINT64   TableIdSignature;
+
+  //
+  // Determine whether there is a TPM2 SSDT already in the ACPI table.
+  //
+  Status = EFI_SUCCESS;
+  TableIndex = 0;
+  TableKey   = 0;
+  TableHeader= NULL;
+  mAcpiTableProtocol = NULL;
+  mAcpiSdtProtocol   = NULL;
+
+  //
+  // Locate the EFI_ACPI_TABLE_PROTOCOL.
+  //
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((
+  DEBUG_INFO,
+  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Table Protocol 
\n "
+  ));
+return Status;
+  }
+
+  //
+  // Locate the EFI_ACPI_SDT_PROTOCOL.
+  //
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((
+  DEBUG_INFO,
+  "UnInstallTpm2SSDTAcpiTables: Cannot locate the EFI ACPI Sdt Protocol, "
+  "\n"
+  ));
+return Status;
+  }
+
+  while (!EFI_ERROR (Status)) {
+Status = mAcpiSdtProtocol->GetAcpiTable (
+ TableIndex,
+ (EFI_ACPI_SDT_HEADER **),
+ ,
+ 
+ );
+
+if (!EFI_ERROR (Status)) {
+  TableIndex++;
+
+  if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature == SIGNATURE_32 
('S', 'S', 'D', 'T')) {
+CopyMem ((VOID *)TableIdString, (VOID *)((EFI_ACPI_SDT_HEADER 
*)TableHeader)->OemTableId, sizeof (TableIdString));
+
+TableIdSignature = SIGNATURE_64 (
+ TableIdString[0],
+ TableIdString[1],
+ TableIdString[2],
+ TableIdString[3],
+ TableIdString[4],
+ TableIdString[5],
+ TableIdString[6],
+ TableIdString[7]
+ );
+
+if (TableIdSignature == SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 
'b', 'l')) {
+  DEBUG ((DEBUG_INFO, "Found Tpm2 SSDT Table for Physical 
Presence\n"));
+  break;
+}
+  }
+}
+  }
+
+  if (!EFI_ERROR (Status)) {
+//
+// A TPM2 SSDT is already in the ACPI table.
+//
+DEBUG ((
+  DEBUG_INFO,
+  "A TPM2 SSDT is already exist in the ACPI Table.\n"
+  ));
+
+//
+// Uninstall the origin TPM2 SSDT from the ACPI table.
+//
+Status = mAcpiTableProtocol->UninstallAcpiTable (
+   mAcpiTableProtocol,
+   TableKey
+   );
+ASSERT_EFI_ERROR (Status);
+
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_INFO, "UnInstall Tpm2SSDTAcpiTables failed \n "));
+
+  return Status;
+}
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Uninstall TPM2 table
+
+  This performs uninstallation of TPM2 tables published by
+  bootloaders.
+
+  @retval   EFI_SUCCESS The TPM2 table is uninstalled successfully if its 
found.
+  @retval   Others  Operation error.
+
+**/
+EFI_STATUS
+UnInstallTpm2Tables (
+  )
+{
+  UINTNTableIndex;
+  UINTNTableKey;
+  EFI_ACPI_TABLE_VERSION   

[edk2-devel] [PATCH v1 5/6] Uefipayloadpkg Enable TPM measured boot

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Update the packages to support TPM and measured
boot in uefi payload.

Measured boot can be controoled using flag MEASURED_BOOT_ENABLE

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Patrick Rudolph 
Signed-off-by: Subash Lakkimsetti 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 88 +--
 UefiPayloadPkg/UefiPayloadPkg.fdf | 25 +
 2 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index f31e5aac16..86612338bf 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -46,6 +46,7 @@
   DEFINE NVME_ENABLE  = TRUE
 
   DEFINE SECURE_BOOT_ENABLE   = FALSE
+  DEFINE MEASURED_BOOT_ENABLE = FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -297,14 +298,27 @@
 !else
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
-!if $(VARIABLE_SUPPORT) == "EMU"
-  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
-!elseif $(VARIABLE_SUPPORT) == "SPI"
-  
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+  #
+  # TPM
+  #
+!if $(MEASURED_BOOT_ENABLE) == TRUE
+  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
+  Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf
+  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
+  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
+  
Tcg2PhysicalPresenceLib|SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf
+  
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
   
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
+!else
+  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+!endif
+!if $(VARIABLE_SUPPORT) == "SPI"
   
S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf
+!endif
+!if $(SECURE_BOOT_ENABLE) == TRUE || $(MEASURED_BOOT_ENABLE) == TRUE || 
$(VARIABLE_SUPPORT) == "SPI"
   
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
 !endif
+  
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
@@ -412,6 +426,10 @@
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
 !endif
 
+!if $(MEASURED_BOOT_ENABLE) == TRUE
+ 
Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
+!endif
+
 

 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform.
@@ -600,6 +618,13 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdFirmwareDebuggerInitialized|FALSE
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x5a, 0xf2, 0x6b, 0x28, 
0xc3, 0xc2, 0x8c, 0x40, 0xb3, 0xb4, 0x25, 0xe6, 0x75, 0x8b, 0x73, 0x17}
 
+!if $(MEASURED_BOOT_ENABLE) == TRUE
+
+  # (BIT0 - SHA1. BIT1 - SHA256, BIT2 - SHA384, BIT3 - SHA512, BIT4 - SM3_256)
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x00016
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap|0x00016
+!endif
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform.
@@ -680,6 +705,10 @@
 
 !if $(SECURE_BOOT_ENABLE)
   
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
+!endif
+!if $(MEASURED_BOOT_ENABLE) == TRUE
+  NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
+  NULL|SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.inf
 !endif
   }
 !endif
@@ -842,6 +871,57 @@
   SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
 !endif
 
+!if $(MEASURED_BOOT_ENABLE) == TRUE
+  SecurityPkg/Tcg/TcgDxe/TcgDxe.inf {
+
+  
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
+   }
+
+   SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDxe.inf {
+
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
+
+!if $(SMM_SUPPORT) == TRUE
+  SecurityPkg/Tcg/TcgSmm/TcgSmm.inf {
+
+
TcgPpVendorLib|SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
+
+  }
+!endif
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf {
+  
+  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
+  
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
+  NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
+  }
+!if $(SMM_SUPPORT) == TRUE
+  

[edk2-devel] [PATCH v1 0/6] Universal payload secure boot and measured boot

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Support added in universal payload to enable secure boot and measured boot

Hob structure header for universal payload for secure boot and measure boot 
information from bootloaders
as per the universal payload spec defined at 
https://universalscalablefirmware.github.io/documentation/2_universal_payload.html

TCG2ACPI: uninstall TPM2 ACPI if updated from Bootloaders and create a new ACPI 
tables.

Secure boot configuration and flags are added to UefiPayloadPkg

Measured boot and TPM configurations are added for UefiPayloadPkg

Subash Lakkimsetti (6):
  MdeModulePkg: universal payload HOB for secure boot info
  UefiPayloadPkg: Add secureboot information HOBs
  TGC2ACPI: Uninstall the TPM2 ACPI if present
  UefiPayloadPkg: Add secure boot configurations
  Uefipayloadpkg Enable TPM measured boot
  UefiPayloadPkg: Add secure boot definitions to ci build

 .../UniversalPayload/SecureBootInfoGuid.h |  37 +++
 SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c   | 251 ++
 SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf |   3 +
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c|  77 +-
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf  |  13 +-
 UefiPayloadPkg/UefiPayloadPkg.ci.yaml |   4 +
 UefiPayloadPkg/UefiPayloadPkg.dec |   4 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc | 127 -
 UefiPayloadPkg/UefiPayloadPkg.fdf |  29 ++
 9 files changed, 534 insertions(+), 11 deletions(-)
 create mode 100644 MdeModulePkg/Include/UniversalPayload/SecureBootInfoGuid.h

-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH v1 4/6] UefiPayloadPkg: Add secure boot configurations

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Add the required modules for secure boot in
UefiPayloadPkg. SECURE_BOOT_ENABLE flag added to control
the secure boot feature. Requires SMM_SUPPORT and
flash to be SPI for the secure boot to function.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Subash Lakkimsetti 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 37 ---
 UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 2f5c70ec9c..f31e5aac16 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -45,6 +45,8 @@
   DEFINE BOOTSPLASH_IMAGE = FALSE
   DEFINE NVME_ENABLE  = TRUE
 
+  DEFINE SECURE_BOOT_ENABLE   = FALSE
+
   #
   # NULL:NullMemoryTestDxe
   # GENERIC: GenericMemoryTestDxe
@@ -287,7 +289,14 @@
   
DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+!if $(SECURE_BOOT_ENABLE)
+  AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+  
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
+  
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+!else
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+!endif
 !if $(VARIABLE_SUPPORT) == "EMU"
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
 !elseif $(VARIABLE_SUPPORT) == "SPI"
@@ -353,6 +362,9 @@
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 !endif
+!if $(VARIABLE_SUPPORT) == "SPI"
+  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+!endif
 
 [LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -469,6 +481,12 @@
   gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.TlsSet.Family   
 | PCD_CRYPTO_SERVICE_ENABLE_FAMILY
   gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.TlsGet.Family   
 | PCD_CRYPTO_SERVICE_ENABLE_FAMILY
 !endif
+!if $(SECURE_BOOT_ENABLE)
+  # override the default values from SecurityPkg to ensure images from all 
sources are verified in secure boot
+  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
+  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
+  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
+!endif
 
 [PcdsPatchableInModule.X64]
 !if $(NETWORK_DRIVER_ENABLE) == TRUE
@@ -629,9 +647,7 @@
   #
   # Components that produce the architectural protocols
   #
-!if $(SECURITY_STUB_ENABLE) == TRUE
-  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-!endif
+
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 !if $(BOOTSPLASH_IMAGE)
@@ -655,6 +671,17 @@
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
 !if $(DISABLE_RESET_SYSTEM) == FALSE
   MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+!endif
+  #
+  # Components that produce the architectural protocols
+  #
+!if $(SECURITY_STUB_ENABLE) == TRUE
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
+
+!if $(SECURE_BOOT_ENABLE)
+  
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
+!endif
+  }
 !endif
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
 !if $(EMU_VARIABLE_ENABLE) == TRUE
@@ -811,6 +838,10 @@
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
 !endif
 
+!if $(SECURE_BOOT_ENABLE)
+  SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!endif
+
   #
   # Misc
   #
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index ee7d718b3f..b52e6c75a5 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -172,6 +172,10 @@ INF 
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
 !endif
 
+!if $(SECURE_BOOT_ENABLE) == TRUE
+  INF 
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!endif
+
 INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
 !if $(MEMORY_TEST) == "GENERIC"
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online 

[edk2-devel] [PATCH v1 1/6] MdeModulePkg: universal payload HOB for secure boot info

2023-03-22 Thread Subash Lakkimsetti
From: Subash Lakkimsetti 

Add the hob structure header for universal payload
for secure boot and measure boot information from
bootloaders. Universal payload spec definied at
https://universalscalablefirmware.github.io/documentation/2_universal_payload.html

Cc: Zhiguang Liu 
Cc: Ray Ni 
Cc: Gua Guo 
Signed-off-by: Subash Lakkimsetti 
---
 .../UniversalPayload/SecureBootInfoGuid.h | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 MdeModulePkg/Include/UniversalPayload/SecureBootInfoGuid.h

diff --git a/MdeModulePkg/Include/UniversalPayload/SecureBootInfoGuid.h 
b/MdeModulePkg/Include/UniversalPayload/SecureBootInfoGuid.h
new file mode 100644
index 00..5f0f75eb3a
--- /dev/null
+++ b/MdeModulePkg/Include/UniversalPayload/SecureBootInfoGuid.h
@@ -0,0 +1,37 @@
+/** @file
+  This file defines the hob structure for the Secure boot information.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SECUREBOOT_INFO_GUID_H_
+#define SECUREBOOT_INFO_GUID_H_
+
+#include 
+
+/**
+  Secure Boot info Hob GUID
+**/
+extern EFI_GUID  gUniversalPayloadSecureBootInfoGuid;
+
+#define PAYLOAD_SECUREBOOT_INFO_HOB_REVISION  0x1
+
+#define NO_TPM   0x0
+#define TPM_TYPE_12  0x1
+#define TPM_TYPE_20  0x2
+
+#pragma pack(1)
+typedef struct {
+  UNIVERSAL_PAYLOAD_GENERIC_HEADERHeader;
+  UINT8   VerifiedBootEnabled;
+  UINT8   MeasuredBootEnabled;
+  UINT8   FirmwareDebuggerInitialized;
+  UINT8   TpmType;
+  UINT8   Reserved[3];
+  UINT32  TpmPcrActivePcrBanks;
+} UNIVERSAL_SECURE_BOOT_INFO;
+#pragma pack()
+
+#endif // SECUREBOOT_INFO_GUID_H_
-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Rebecca Cran
I'm not seeing this failure. Could you tell me what the following 
commands print, please:



where clang

where lld


Mine are:


C:\Users\bcran\Documents\src\uefi\edk2>where clang
C:\Program Files\LLVM\bin\clang.exe
C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\Llvm\bin\clang.exe


C:\Users\bcran\Documents\src\uefi\edk2>where lld
C:\Program Files\LLVM\bin\lld.exe
C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\Llvm\bin\lld.exe



Also, could you provide more of the output?


On 3/21/23 10:57 PM, Guo, Gua wrote:


Try to verify the patch on my local. Could you help to check whether 
it happen on your side ?


Please make sure windows build is not broken before code submitting.

Before the commit:

  * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
VS2019 PASS
  o Install

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
  o Install VS2019
  o edksetup.bat Rebuild
  o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

  * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
GCC5 PASS
  o sudo apt install clang-10 llvm-10
  o source edksetup.sh
  o make -C BaseTools
  o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

After the commit:

  * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
VS2019 FAIL
  o Install

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
  o Install VS2019
  o edksetup.bat Rebuild
  o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019
 o

  * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
GCC5 PASS
  o sudo apt install clang-10 llvm-10
  o source edksetup.sh
  o make -C BaseTools
  o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

Thanks,

Gua

-Original Message-

From: devel@edk2.groups.io  On Behalf Of Rebecca 
Cran


Sent: Wednesday, March 22, 2023 9:31 AM

To: devel@edk2.groups.io; Kinney, Michael D 
; Gao, Liming ; 
Liu, Zhiguang ; Feng, Bob C 
; Chen, Christine ; Andrew 
Fish ; Leif Lindholm ; Ard 
Biesheuvel ; Justen, Jordan L 
; Gerd Hoffmann 


Cc: Rebecca Cran 

Subject: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF 
toolchain and remove CLANG35 and CLANG38


Update the CLANGDWARF toolchain definition with the settings from 
CLANG38, and delete the CLANG35 and CLANG38 toolchains.


The existing CLANGDWARF toolchain definition used ld.lld, but this 
causes the following linker errors when building OvmfPkgX64.dsc:


ld.lld: error: relocation R_X86_64_64 cannot be used against local 
symbol; recompile with -fPIC


>>> defined in

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>>> referenced by 
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>>> ExceptionHandlerAsm.obj:(.text+0x5) in archive

>>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiC

>>> puPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OU

>>> TPUT/SecPeiCpuExceptionHandlerLib.lib

ld.lld: error: relocation R_X86_64_64 cannot be used against local 
symbol; recompile with -fPIC


>>> defined in

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>>> referenced by 
edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>>> ExceptionHandlerAsm.obj:(.text+0x14) in archive

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib

To avoid this, use the default ld (which is normally GNU ld) instead.

Signed-off-by: Rebecca Cran 

---

BaseTools/Conf/tools_def.template | 453 

1 file changed, 171 insertions(+), 282 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template


index 471eb67c0c83..a790366063ea 100755

--- a/BaseTools/Conf/tools_def.template

+++ b/BaseTools/Conf/tools_def.template

@@ -273,32 +273,21 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc

# Required to build platforms or ACPI tables:

#   Intel(r) ACPI Compiler from

# https://acpica.org/downloads

-#

-#   CLANG35 -Linux,Windows- Requires:

-# Clang v3.5 or later, and GNU binutils 
targeting aarch64-linux-gnu or arm-linux-gnueabi


-#    Optional:

-# Required to build 

Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 14:03, Gerd Hoffmann  wrote:
>
> On Wed, Mar 22, 2023 at 01:32:01PM +0100, Ard Biesheuvel wrote:
> > On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  wrote:
> > >
> > > On 3/22/23 5:49 AM, Ard Biesheuvel wrote:
> > >
> > > > The reason I added CLANG3x support for ARM in the past is to ensure
> > > > compatibility with the ARM proprietary, Clang based toolchain. At the
> > > > time, we went with GNU ld, but I would actually prefer if we could
> > > > make this work with LLD as well.
> > > >
> > > > I can work around this issue locally by doing
> > > >
> > > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > > @@ -297,7 +297,7 @@
> > > > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > > > 
> > > > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > > > 
> > > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > > > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > > > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > > > 
> > > > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> > > >   !else
> > > >
> > > > Can you please check whether this works for you as well?
> > >
> > > Thanks, that works here too!
> > >
> > > Do we still need to keep CLANG35 and CLANG38 toolchains for
> > > compatibility with the ARM toolchain? Or have things moved on so they
> > > _can_ be removed?
> > >
> >
> > No, please go ahead and merge all of those - the 35/38 naming is so
> > out of date it is likely to confuse people, so we should rename those
> > in any case.
>
> Same goes for all the GCC4x toolchains I guess ...
>

Indeed - we should just drop those, and rename GCC5 to GCC


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




Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Gerd Hoffmann
On Wed, Mar 22, 2023 at 01:32:01PM +0100, Ard Biesheuvel wrote:
> On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  wrote:
> >
> > On 3/22/23 5:49 AM, Ard Biesheuvel wrote:
> >
> > > The reason I added CLANG3x support for ARM in the past is to ensure
> > > compatibility with the ARM proprietary, Clang based toolchain. At the
> > > time, we went with GNU ld, but I would actually prefer if we could
> > > make this work with LLD as well.
> > >
> > > I can work around this issue locally by doing
> > >
> > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > @@ -297,7 +297,7 @@
> > > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > > 
> > > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > > 
> > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > > 
> > > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> > >   !else
> > >
> > > Can you please check whether this works for you as well?
> >
> > Thanks, that works here too!
> >
> > Do we still need to keep CLANG35 and CLANG38 toolchains for
> > compatibility with the ARM toolchain? Or have things moved on so they
> > _can_ be removed?
> >
> 
> No, please go ahead and merge all of those - the 35/38 naming is so
> out of date it is likely to confuse people, so we should rename those
> in any case.

Same goes for all the GCC4x toolchains I guess ...

take care,
  Gerd



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




Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  wrote:
>
> On 3/22/23 5:49 AM, Ard Biesheuvel wrote:
>
> > The reason I added CLANG3x support for ARM in the past is to ensure
> > compatibility with the ARM proprietary, Clang based toolchain. At the
> > time, we went with GNU ld, but I would actually prefer if we could
> > make this work with LLD as well.
> >
> > I can work around this issue locally by doing
> >
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -297,7 +297,7 @@
> > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > 
> > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > 
> > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > 
> > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> >   !else
> >
> > Can you please check whether this works for you as well?
>
> Thanks, that works here too!
>
> Do we still need to keep CLANG35 and CLANG38 toolchains for
> compatibility with the ARM toolchain? Or have things moved on so they
> _can_ be removed?
>

No, please go ahead and merge all of those - the 35/38 naming is so
out of date it is likely to confuse people, so we should rename those
in any case.

I haven't tried building EDK2 for ARM with LLD myself - let me know if
you run into any issues there.


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




Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds AMD/BoardPkg and AMD/PlatformPkg maintainers

2023-03-22 Thread Leif Lindholm
On Wed, Mar 22, 2023 at 11:59:38 +, Attar, AbdulLateef (Abdul Lateef) wrote:
> [Public]
> 
> Hi Abner,
> That's right, Platform/AMD/MinBoardPkg will contains all
> modules/library/drivers required for AMD boards which are
> based on MinPlatformPkg framework.

That works for me.

/
Leif

> Thanks
> AbduL
> 
> -Original Message-
> From: Chang, Abner 
> Sent: 22 March 2023 15:25
> To: Attar, AbdulLateef (Abdul Lateef) ; Leif 
> Lindholm 
> Cc: devel@edk2.groups.io; Ard Biesheuvel ; Michael 
> D Kinney 
> Subject: RE: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds 
> AMD/BoardPkg and AMD/PlatformPkg maintainers
> 
> [AMD Official Use Only - General]
> 
> 
> 
> > -Original Message-
> > From: Attar, AbdulLateef (Abdul Lateef) 
> > Sent: Tuesday, March 21, 2023 11:01 AM
> > To: Leif Lindholm 
> > Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> > Biesheuvel ; Michael D Kinney
> > 
> > Subject: RE: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> > AMD/BoardPkg and AMD/PlatformPkg maintainers
> >
> > [AMD Official Use Only - General]
> >
> > Hi Leif,
> > AMD/BoardPkg will implements modules specific to boards(one or
> > more motherboards).
> > It will not contain any module specific to Platform or Silicon, which
> > are part of MinPlatformPkg.
> >
> > How about just Min prefix?
> > AMD/MinBoardPkg (I am avoiding the Amd prefix because its already in
> > AMD folder).
> I am good with this naming. So we will have AMD boards that leverage 
> MinPlatform under MinBoardPkg. Those boards which are not Minplatform based 
> can just stay under Platforms/AMD (e.g., OverdriveBoard.), is my 
> understanding correct Abdul?
> Abner
> >
> > AMD board package for MinPlatformPkg
> >  F: Platform/AMD/MinBoardPkg
> >  M: Maintainer1
> >  M: Maintainer2
> >
> > Thanks
> > AbduL
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: 20 March 2023 23:33
> > To: Attar, AbdulLateef (Abdul Lateef) 
> > Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> > Biesheuvel ; Michael D Kinney
> > 
> > Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> > AMD/BoardPkg and AMD/PlatformPkg maintainers
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abdul,
> >
> > On Mon, Mar 20, 2023 at 14:09:11 +, Attar, AbdulLateef (Abdul
> > Lateef)
> > wrote:
> > > AMD/BoardPkg will contains the modules/drivers to support
> > MinPlatformPkg framework.
> > >BoardPkg will be generic across all AMD boards which are based on
> > MinPlatformPkg framework.
> > >It's like "edk2-platforms/Platform/Qemu/QemuOpenBoardPkg".
> > >We will gradually add modules and libraries to it.
> >
> > So, if the purpose is exclusively to support MinPlatformPkg platforms,
> > I think that should be part of the name.
> > Like Platform/AMD/AmdMinPlatformPkg (for example).
> >
> > > AMD/PlatformPkg will contain the modules/drivers which are generic
> > > to
> > future AMD platform.
> > >Currently we don't have complete platform, we can drop
> > >PlatformPkg for now till we have complete(reasonable modules)
> > >solution.
> >
> > It will certainly be easier to reason about what the preferred
> > naming/layout should be once there is code to look at for examples.
> > It may be that parts of it would live more naturally under
> > Silicon/AMD, for example.
> >
> > > It's better to not touch existing AMD/OverdriveBoard, restructuring
> > > requires changes to .dsc and .fdf files, might break backward
> > > compatibility.
> >
> > No problem. Config files occasionally need to be revamped, but that's
> > simply a mechanical exercise.
> >
> > > How about having just BoardPkg like below?
> >
> > That, too, is a completely generic name that conveys no information
> > about
> > *what* boards one can expect to find in there.
> >
> > Regards,
> >
> > Leif
> >
> > > AMD board package
> > > F: Platform/AMD/BoardPkg
> > > M: Maintainer1
> > > M: Maintainer2
> > >
> > > Please let me know your thoughts.
> > >
> > > Thanks
> > > AbduL
> > >
> > >
> > >
> > >
> > > -Original Message-
> > > From: Leif Lindholm 
> > > Sent: 20 March 2023 18:35
> > > To: devel@edk2.groups.io; Chang, Abner 
> > > Cc: Attar, AbdulLateef (Abdul Lateef) ;
> > > Ard Biesheuvel ; Michael D Kinney
> > > 
> > > Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt:
> > > Adds AMD/BoardPkg and AMD/PlatformPkg maintainers
> > >
> > > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > Hi Abner,
> > >
> > > On Sat, Mar 18, 2023 at 09:16:17 +, Chang, Abner via groups.io wrote:
> > > > I don't see any modules under OverdriveBoard, is this package
> > > > still
> > >
> > > The code is split between Platform/AMD and Silicon/AMD/Styx, the
> > > latter
> > also being used by 

Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Rebecca Cran

On 3/22/23 5:49 AM, Ard Biesheuvel wrote:


The reason I added CLANG3x support for ARM in the past is to ensure
compatibility with the ARM proprietary, Clang based toolchain. At the
time, we went with GNU ld, but I would actually prefer if we could
make this work with LLD as well.

I can work around this issue locally by doing

--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -297,7 +297,7 @@
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf

PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf

MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-!if $(TOOL_CHAIN_TAG) == "XCODE5"
+!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"

CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
  !else

Can you please check whether this works for you as well?


Thanks, that works here too!

Do we still need to keep CLANG35 and CLANG38 toolchains for 
compatibility with the ARM toolchain? Or have things moved on so they 
_can_ be removed?



--
Rebecca Cran



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




Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 02:30, Rebecca Cran  wrote:
>
> Update the CLANGDWARF toolchain definition with the settings from
> CLANG38, and delete the CLANG35 and CLANG38 toolchains.
>
> The existing CLANGDWARF toolchain definition used ld.lld, but this
> causes the following linker errors when building OvmfPkgX64.dsc:
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol;
> recompile with -fPIC
> >>> defined in 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by 
> >>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>>   ExceptionHandlerAsm.obj:(.text+0x5) in archive 
> >>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; 
> recompile with -fPIC
> >>> defined in 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>>   ExceptionHandlerAsm.obj:(.text+0x14) in archive 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> To avoid this, use the default ld (which is normally GNU ld) instead.
>

The reason I added CLANG3x support for ARM in the past is to ensure
compatibility with the ARM proprietary, Clang based toolchain. At the
time, we went with GNU ld, but I would actually prefer if we could
make this work with LLD as well.

I can work around this issue locally by doing

--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -297,7 +297,7 @@
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
   
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
   
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-!if $(TOOL_CHAIN_TAG) == "XCODE5"
+!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
 !else

Can you please check whether this works for you as well?





> Signed-off-by: Rebecca Cran 
> ---
>  BaseTools/Conf/tools_def.template | 453 
>  1 file changed, 171 insertions(+), 282 deletions(-)
>
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index 471eb67c0c83..a790366063ea 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -273,32 +273,21 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
> -#
> -#   CLANG35 -Linux,Windows-  Requires:
> -# Clang v3.5 or later, and GNU binutils 
> targeting aarch64-linux-gnu or arm-linux-gnueabi
> -#Optional:
> -# Required to build platforms or ACPI tables:
> -#   Intel(r) ACPI Compiler from
> -#   https://acpica.org/downloads
> -#   CLANG38  -Linux-  Requires:
> -# Clang v3.8, LLVMgold plugin and GNU binutils 
> 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi
> -# Clang v3.9 or later, LLVMgold plugin and GNU 
> binutils 2.28 targeting x86_64-linux-gnu, aarch64-linux-gnu or 
> arm-linux-gnueabi
> +#   CLANGDWARF  -Linux-  Requires:
> +# Clang 9 or above, and GNU binutils targeting 
> x86_64-linux-gnu, aaarch64-linux-gnu or arm-linux-gnuaebi
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
> +# Required to compile nasm source:
> +#   nasm compiler from
> +#   NASM -- https://nasm.us
>  #   CLANGPDB -Linux, Windows, Mac-  Requires:
>  # Clang 9 or above from http://releases.llvm.org/
>  #Optional:
>  # Required to 

Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds AMD/BoardPkg and AMD/PlatformPkg maintainers

2023-03-22 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]



> -Original Message-
> From: Attar, AbdulLateef (Abdul Lateef) 
> Sent: Tuesday, March 21, 2023 11:01 AM
> To: Leif Lindholm 
> Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> Biesheuvel ; Michael D Kinney
> 
> Subject: RE: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> AMD/BoardPkg and AMD/PlatformPkg maintainers
> 
> [AMD Official Use Only - General]
> 
> Hi Leif,
> AMD/BoardPkg will implements modules specific to boards(one or more
> motherboards).
> It will not contain any module specific to Platform or Silicon, which are 
> part of
> MinPlatformPkg.
> 
> How about just Min prefix?
> AMD/MinBoardPkg (I am avoiding the Amd prefix because its already in AMD
> folder).
I am good with this naming. So we will have AMD boards that leverage 
MinPlatform under MinBoardPkg. Those boards which are not Minplatform based can 
just stay under Platforms/AMD (e.g., OverdriveBoard.), is my understanding 
correct Abdul?
Abner
> 
> AMD board package for MinPlatformPkg
>  F: Platform/AMD/MinBoardPkg
>  M: Maintainer1
>  M: Maintainer2
> 
> Thanks
> AbduL
> 
> -Original Message-
> From: Leif Lindholm 
> Sent: 20 March 2023 23:33
> To: Attar, AbdulLateef (Abdul Lateef) 
> Cc: devel@edk2.groups.io; Chang, Abner ; Ard
> Biesheuvel ; Michael D Kinney
> 
> Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> AMD/BoardPkg and AMD/PlatformPkg maintainers
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Hi Abdul,
> 
> On Mon, Mar 20, 2023 at 14:09:11 +, Attar, AbdulLateef (Abdul Lateef)
> wrote:
> > AMD/BoardPkg will contains the modules/drivers to support
> MinPlatformPkg framework.
> >BoardPkg will be generic across all AMD boards which are based on
> MinPlatformPkg framework.
> >It's like "edk2-platforms/Platform/Qemu/QemuOpenBoardPkg".
> >We will gradually add modules and libraries to it.
> 
> So, if the purpose is exclusively to support MinPlatformPkg platforms, I think
> that should be part of the name.
> Like Platform/AMD/AmdMinPlatformPkg (for example).
> 
> > AMD/PlatformPkg will contain the modules/drivers which are generic to
> future AMD platform.
> >Currently we don't have complete platform, we can drop
> >PlatformPkg for now till we have complete(reasonable modules)
> >solution.
> 
> It will certainly be easier to reason about what the preferred naming/layout
> should be once there is code to look at for examples.
> It may be that parts of it would live more naturally under Silicon/AMD, for
> example.
> 
> > It's better to not touch existing AMD/OverdriveBoard, restructuring
> > requires changes to .dsc and .fdf files, might break backward
> > compatibility.
> 
> No problem. Config files occasionally need to be revamped, but that's simply
> a mechanical exercise.
> 
> > How about having just BoardPkg like below?
> 
> That, too, is a completely generic name that conveys no information about
> *what* boards one can expect to find in there.
> 
> Regards,
> 
> Leif
> 
> > AMD board package
> > F: Platform/AMD/BoardPkg
> > M: Maintainer1
> > M: Maintainer2
> >
> > Please let me know your thoughts.
> >
> > Thanks
> > AbduL
> >
> >
> >
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: 20 March 2023 18:35
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Attar, AbdulLateef (Abdul Lateef) ; Ard
> > Biesheuvel ; Michael D Kinney
> > 
> > Subject: Re: [edk2-devel] [PATCH v2 RESEND 4/4] Maintainers.txt: Adds
> > AMD/BoardPkg and AMD/PlatformPkg maintainers
> >
> > Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abner,
> >
> > On Sat, Mar 18, 2023 at 09:16:17 +, Chang, Abner via groups.io wrote:
> > > I don't see any modules under OverdriveBoard, is this package still
> >
> > The code is split between Platform/AMD and Silicon/AMD/Styx, the latter
> also being used by SoftIron/Overdrive1000 and LeMaker Cello (although that
> one is pretty much defunct and should probably be dropped).
> >
> > > in use? Do you still remember where is FDF and DSC come from (as
> > > there is AMD copyright 2014-2016) back to the moment when you was
> > > introduced this package?
> >
> > As the git history tells you:
> > ---
> > commit f4d38e50c0f24eb78eb003a94f583025621c63db
> > Author: Leif Lindholm 
> > Date:   Thu Aug 3 12:24:22 2017 +0100
> >
> > Platform,Silicon: import AMD Styx SoC support and platforms
> >
> > Common files for AMD Overdrive, SoftIron Overdrive 1000
> > and LeMaker Cello, as well as actual platform support.
> > Imported from commit efd798c1eb of
> > https://git.linaro.org/uefi/OpenPlatformPkg.git
> > ---
> >
> > and the initial commit of the platform in that repository is:
> > ---
> > From: Leo Duran 
> > Date: Thu, 20 Aug 2015 13:30:24 -0500
> >
> > Subject: 

Re: [edk2-devel] [PATCH 0/9] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38 and update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-22 Thread Ard Biesheuvel
Hello Rebecc,

Thanks for working on this - the toolchain definitions are not the
most fun part of the project.

On Wed, 22 Mar 2023 at 02:30, Rebecca Cran  wrote:
>
> Update the toolchain definitions:
>
> - Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
>   CLANGDWARF, updating it to support ARM and AARCH64 in addition to X64
> and IA32.
>
> - Remove VS2008, VS2010, VS2012 and VS2013.
>
> - Remove EBC compiler definitions. Full removal of EBC support from the
>   various packages etc. will be done in a follow-up patch series.
>
> - Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS definitions.
>

Please add some motivation as to *why* these changes improve upon the
current situation. Removing stuff is generally a good thing, but it
makes a difference whether keeping it is problematic or it whether is
just janitorial work.

> Personal GitHub PR: https://github.com/tianocore/edk2/pull/4158
> GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf
>
> Rebecca Cran (9):
>   OvmfPkg: Replace static struct initialization with ZeroMem call
>   CryptoPkg: Add CLANGDWARF and remove CLANG35 and CLANG38 compiler
> flags
>   BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38
>   BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
>   BaseTools: Remove VS2008-VS2013 remnants
>   MdePkg: Remove VS2008-VS2013 remnants
>   edksetup.bat: Remove VS2008-VS2013 remnants
>   BaseTools: Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS defs
>   BaseTools: Remove EBC (EFI Byte Code) compiler definitions
>
>  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf |3 +-
>  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  |3 +-
>  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  |3 +-
>  CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  |3 +-
>  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  |3 +-
>  CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf |3 +-
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf |3 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf|3 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   |3 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibFull.inf |3 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf|3 +-
>  MdePkg/Include/Ia32/ProcessorBind.h |8 +-
>  MdePkg/Include/X64/ProcessorBind.h  |8 +-
>  OvmfPkg/Library/PlatformInitLib/MemDetect.c |4 +-
>  BaseTools/Conf/tools_def.template   | 1572 
> +++-
>  BaseTools/Scripts/SetVisualStudio.bat   |   22 +-
>  BaseTools/Scripts/ShowEnvironment.bat   |   44 -
>  BaseTools/get_vsvars.bat|   13 -
>  BaseTools/set_vsprefix_envs.bat |   64 -
>  BaseTools/toolsetup.bat |   24 +-
>  edksetup.bat|6 +-
>  21 files changed, 192 insertions(+), 1606 deletions(-)
>
> --
> 2.34.1
>


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




Re: [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() macro.

2023-03-22 Thread Ni, Ray
Reviewed-by: Ray Ni 

thanks,
ray

From: Gerd Hoffmann 
Sent: Wednesday, March 22, 2023 3:02:43 PM
To: devel@edk2.groups.io 
Cc: Kinney, Michael D ; Aktas, Erdem 
; James Bottomley ; Gao, Liming 
; Marvin Häuser ; Pawel Polawski 
; Michael Roth ; Tom Lendacky 
; Gerd Hoffmann ; Yao, Jiewen 
; Wang, Jian J ; Ard Biesheuvel 
; Justen, Jordan L ; Wu, 
Hao A ; Liu, Zhiguang ; Ni, Ray 
; Xu, Min M ; Oliver Steffen 

Subject: [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() macro.

Drop MtrrLibIsPowerOfTwo function, use the new IS_POW2() macro instead.

The ASSERT() removed (inside MtrrLibIsPowerOfTwo) is superfluous,
another ASSERT() a few lines up in MtrrLibCalculateMtrrs() already
guarantees that Length can not be zero at this point.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c 
b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index e5c862c83d61..dd0b668d7782 100644
--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
@@ -1253,21 +1253,6 @@ MtrrLibLowestType (
   return (MTRR_MEMORY_CACHE_TYPE)Type;
 }

-/**
-  Return TRUE when the Operand is exactly power of 2.
-
-  @retval TRUE  Operand is exactly power of 2.
-  @retval FALSE Operand is not power of 2.
-**/
-BOOLEAN
-MtrrLibIsPowerOfTwo (
-  IN UINT64  Operand
-  )
-{
-  ASSERT (Operand != 0);
-  return (BOOLEAN)((Operand & (Operand - 1)) == 0);
-}
-
 /**
   Calculate the subtractive path from vertex Start to Stop.

@@ -1638,7 +1623,7 @@ MtrrLibCalculateMtrrs (
   break;
 }

-if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && MtrrLibIsPowerOfTwo 
(Length)) {
+if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && IS_POW2 (Length)) {
   if (MtrrLibGetNumberOfTypes (
 Ranges,
 RangeCount,
--
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101567): https://edk2.groups.io/g/devel/message/101567
Mute This Topic: https://groups.io/mt/97773225/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] [edk2-staging/crypto-new-api][PATCH] CryptoPkg: Move ECC feature to OpensslLibFull

2023-03-22 Thread Heng Luo
Reviewed-by: Heng Luo 

> -Original Message-
> From: Li, Yi1 
> Sent: Wednesday, March 22, 2023 2:38 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Gao, Zhichao ; Luo,
> Heng 
> Subject: [edk2-staging/crypto-new-api][PATCH] CryptoPkg: Move ECC feature
> to OpensslLibFull
> 
> The purpose is to use OpensslLib to compile drivers that do not require ECC
> functions, instead of enabling ECC unconditionally.
> 
> Cc: Zhichao Gao 
> Cc: Heng Luo 
> Signed-off-by: Yi Li 
> ---
>  CryptoPkg/Library/OpensslLib/EcSm2Null.c  | 421 +++
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  49 +-
>  .../Library/OpensslLib/OpensslLibFull.inf | 708 ++
>  3 files changed, 1131 insertions(+), 47 deletions(-)  create mode 100644
> CryptoPkg/Library/OpensslLib/EcSm2Null.c
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
> 
> diff --git a/CryptoPkg/Library/OpensslLib/EcSm2Null.c
> b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
> new file mode 100644
> index 00..6ae538a3b3
> --- /dev/null
> +++ b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
> @@ -0,0 +1,421 @@
> +/** @file
> +  Null implementation of EC and SM2 functions called by BaseCryptLib.
> +
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +
> +#undef OPENSSL_NO_EC
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +void
> +EC_GROUP_free (
> +  EC_GROUP  *group
> +  )
> +{
> +  ASSERT (FALSE);
> +}
> +
> +int
> +EC_GROUP_get_order (
> +  const EC_GROUP  *group,
> +  BIGNUM  *order,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_GROUP_get_curve_name (
> +  const EC_GROUP  *group
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_GROUP_get_curve (
> +  const EC_GROUP  *group,
> +  BIGNUM  *p,
> +  BIGNUM  *a,
> +  BIGNUM  *b,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_GROUP_get_degree (
> +  const EC_GROUP  *group
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +EC_GROUP *
> +EC_GROUP_new_by_curve_name (
> +  int  nid
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +EC_POINT *
> +EC_POINT_new (
> +  const EC_GROUP  *group
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +void
> +EC_POINT_free (
> +  EC_POINT  *point
> +  )
> +{
> +  ASSERT (FALSE);
> +}
> +
> +void
> +EC_POINT_clear_free (
> +  EC_POINT  *point
> +  )
> +{
> +  ASSERT (FALSE);
> +}
> +
> +int
> +EC_POINT_set_affine_coordinates (
> +  const EC_GROUP  *group,
> +  EC_POINT*p,
> +  const BIGNUM*x,
> +  const BIGNUM*y,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_get_affine_coordinates (
> +  const EC_GROUP  *group,
> +  const EC_POINT  *p,
> +  BIGNUM  *x,
> +  BIGNUM  *y,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_set_compressed_coordinates (
> +  const EC_GROUP  *group,
> +  EC_POINT*p,
> +  const BIGNUM*x,
> +  int y_bit,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_add (
> +  const EC_GROUP  *group,
> +  EC_POINT*r,
> +  const EC_POINT  *a,
> +  const EC_POINT  *b,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_invert (
> +  const EC_GROUP  *group,
> +  EC_POINT*a,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_is_at_infinity (
> +  const EC_GROUP  *group,
> +  const EC_POINT  *p
> +  )
> +{
> +  ASSERT (FALSE);
> +  return 0;
> +}
> +
> +int
> +EC_POINT_is_on_curve (
> +  const EC_GROUP  *group,
> +  const EC_POINT  *point,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return -1;
> +}
> +
> +int
> +EC_POINT_cmp (
> +  const EC_GROUP  *group,
> +  const EC_POINT  *a,
> +  const EC_POINT  *b,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return -1;
> +}
> +
> +int
> +EC_POINT_mul (
> +  const EC_GROUP  *group,
> +  EC_POINT*r,
> +  const BIGNUM*n,
> +  const EC_POINT  *q,
> +  const BIGNUM*m,
> +  BN_CTX  *ctx
> +  )
> +{
> +  ASSERT (FALSE);
> +  return -0;
> +}
> +
> +EC_KEY *
> +EC_KEY_new_by_curve_name (
> +  int  nid
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +void
> +EC_KEY_free (
> +  EC_KEY  *key
> +  )
> +{
> +  ASSERT (FALSE);
> +}
> +
> +EC_KEY *
> +EC_KEY_dup (
> +  const EC_KEY  *src
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +const EC_GROUP *
> +EC_KEY_get0_group (
> +  const EC_KEY  *key
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +const EC_POINT *
> +EC_KEY_get0_public_key (
> +  const EC_KEY  *key
> +  )
> +{
> +  ASSERT (FALSE);
> +  return NULL;
> +}
> +
> +int
> 

[edk2-devel] [PATCH v2 5/6] OvmfPkg: Consume new alignment-related macros

2023-03-22 Thread Gerd Hoffmann
This patch substitutes the macros that were renamed in the second
patch with the new, shared alignment macros.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Michael D Kinney 
Reviewed-by: Jiewen Yao 
Acked-by: Tom Lendacky 
---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c   | 6 ++
 .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index 71a1eaaf0a1d..9b0d0e92b6f7 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -44,8 +44,6 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
 
 STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
 
-#define IS_ALIGNED_(x, y)  x) & ((y) - 1)) == 0))
-
 STATIC
 EFI_STATUS
 EFIAPI
@@ -60,8 +58,8 @@ AmdSevMemoryAccept (
   // multiple of SIZE_4KB. Use an assert instead of returning an erros since
   // this is an EDK2-internal protocol.
   //
-  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));
-  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));
+  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));
+  ASSERT (IS_ALIGNED (Size, SIZE_4KB));
   ASSERT (Size != 0);
 
   MemEncryptSevSnpPreValidateSystemRam (
diff --git 
a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c 
b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index f35bba5deb46..7a8878b1a9c2 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -20,7 +20,6 @@
 
 #include "SnpPageStateChange.h"
 
-#define IS_ALIGNED_(x, y)  x) & (y - 1)) == 0))
 #define PAGES_PER_LARGE_ENTRY  512
 
 STATIC
@@ -150,7 +149,7 @@ BuildPageStateBuffer (
 //
 // Is this a 2MB aligned page? Check if we can use the Large RMP entry.
 //
-if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&
+if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&
 ((EndAddress - BaseAddress) >= SIZE_2MB))
 {
   RmpPageSize = PvalidatePageSize2MB;
-- 
2.39.2



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




[edk2-devel] [PATCH v2 1/6] MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions

2023-03-22 Thread Gerd Hoffmann
From: Marvin Häuser 

This patch is a preparation for the patches that follow. The
subsequent patches will introduce and integrate new alignment-related
macros, which collide with existing definitions in MdeModulePkg.
Temporarily rename them to avoid build failure, till they can be
substituted with the new, shared definitions.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Marvin Häuser 
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Hao A Wu 
Reviewed-by: Michael D Kinney 
---
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  4 +--
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h   |  2 +-
 MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h   |  2 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h  |  2 +-
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h |  2 +-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  2 +-
 MdeModulePkg/Universal/EbcDxe/EbcExecute.h|  4 +--
 MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c   |  2 +-
 .../Bus/Ata/AhciPei/AhciPeiPassThru.c |  6 ++--
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c   | 12 +++
 .../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c|  2 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c  |  4 +--
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  6 ++--
 MdeModulePkg/Universal/EbcDxe/EbcExecute.c| 36 +--
 14 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h 
b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
index 4aed1cb7ad8a..71d34c962ad1 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
@@ -146,8 +146,8 @@ typedef union {
 #define AHCI_PORT_SERR  0x0030
 #define AHCI_PORT_CI0x0038
 
-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
-#define TIMER_PERIOD_SECONDS(Seconds)  MultU64x32((UINT64)(Seconds), 1000)
+#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
+#define TIMER_PERIOD_SECONDS(Seconds)MultU64x32((UINT64)(Seconds), 
1000)
 
 #pragma pack(1)
 
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
index 62ba6d6680dd..7937886614e1 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
@@ -148,7 +148,7 @@ struct _ATA_NONBLOCK_TASK {
 #define ATA_ATAPI_TIMEOUT   EFI_TIMER_PERIOD_SECONDS(3)
 #define ATA_SPINUP_TIMEOUT  EFI_TIMER_PERIOD_SECONDS(10)
 
-#define IS_ALIGNED(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
+#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
 
 #define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
   CR (a, \
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h 
b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
index 4428c484fd6c..47346e911d47 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
@@ -76,7 +76,7 @@
 #define ATA_TASK_SIGNATURE  SIGNATURE_32 ('A', 'T', 'S', 'K')
 #define ATA_DEVICE_SIGNATURESIGNATURE_32 ('A', 'B', 'I', 'D')
 #define ATA_SUB_TASK_SIGNATURE  SIGNATURE_32 ('A', 'S', 'T', 'S')
-#define IS_ALIGNED(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
+#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
 
 //
 // ATA bus data structure for ATA controller
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
index 5b4047e1dbdd..ed384ad52182 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
@@ -38,7 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #define IS_DEVICE_FIXED(a)  (a)->FixedDevice ? 1 : 0
 
-#define IS_ALIGNED(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
+#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
 
 #define UFS_WLUN_RPMB  0xC4
 
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h 
b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
index a0b615b7eab3..1adb382aa8c3 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
@@ -133,7 +133,7 @@ typedef struct _UFS_PEIM_HC_PRIVATE_DATA {
 
 #define ROUNDUP8(x)  (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
 
-#define IS_ALIGNED(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
+#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
 
 #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, 
UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
 #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a)CR (a, 
UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index 2b4f5d32d901..0ec37e56652b 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -105,7 +105,7 @@ typedef struct {
 
 #define 

[edk2-devel] [PATCH v2 4/6] MdeModulePkg: Consume new alignment-related macros

2023-03-22 Thread Gerd Hoffmann
From: Marvin Häuser 

This patch substitutes the macros that were renamed in the first
patch with the new, shared alignment macros.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Vitaly Cheptsov 
Signed-off-by: Marvin Häuser 
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Hao A Wu 
Reviewed-by: Michael D Kinney >michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  3 +-
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h   |  2 --
 MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h   |  1 -
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h  |  2 --
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h |  2 --
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  2 --
 MdeModulePkg/Universal/EbcDxe/EbcExecute.h|  3 +-
 MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c   |  2 +-
 .../Bus/Ata/AhciPei/AhciPeiPassThru.c |  6 ++--
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c   | 12 +++
 .../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c|  2 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c  |  4 +--
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  6 ++--
 MdeModulePkg/Universal/EbcDxe/EbcExecute.c| 36 +--
 14 files changed, 36 insertions(+), 47 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h 
b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
index 71d34c962ad1..e2e4ba43e7c4 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
@@ -146,8 +146,7 @@ typedef union {
 #define AHCI_PORT_SERR  0x0030
 #define AHCI_PORT_CI0x0038
 
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
-#define TIMER_PERIOD_SECONDS(Seconds)MultU64x32((UINT64)(Seconds), 
1000)
+#define TIMER_PERIOD_SECONDS(Seconds)  MultU64x32((UINT64)(Seconds), 1000)
 
 #pragma pack(1)
 
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
index 7937886614e1..016fc6890ae9 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
@@ -148,8 +148,6 @@ struct _ATA_NONBLOCK_TASK {
 #define ATA_ATAPI_TIMEOUT   EFI_TIMER_PERIOD_SECONDS(3)
 #define ATA_SPINUP_TIMEOUT  EFI_TIMER_PERIOD_SECONDS(10)
 
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
-
 #define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
   CR (a, \
   ATA_ATAPI_PASS_THRU_INSTANCE, \
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h 
b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
index 47346e911d47..6bc345f7e777 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
@@ -76,7 +76,6 @@
 #define ATA_TASK_SIGNATURE  SIGNATURE_32 ('A', 'T', 'S', 'K')
 #define ATA_DEVICE_SIGNATURESIGNATURE_32 ('A', 'B', 'I', 'D')
 #define ATA_SUB_TASK_SIGNATURE  SIGNATURE_32 ('A', 'S', 'T', 'S')
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
 
 //
 // ATA bus data structure for ATA controller
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h 
b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
index ed384ad52182..5a25b55c4952 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
@@ -38,8 +38,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #define IS_DEVICE_FIXED(a)  (a)->FixedDevice ? 1 : 0
 
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
-
 #define UFS_WLUN_RPMB  0xC4
 
 typedef struct {
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h 
b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
index 1adb382aa8c3..ed4776f548e0 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
@@ -133,8 +133,6 @@ typedef struct _UFS_PEIM_HC_PRIVATE_DATA {
 
 #define ROUNDUP8(x)  (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
 
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
-
 #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, 
UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
 #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a)CR (a, 
UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
 #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a)  CR (a, 
UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index 0ec37e56652b..bc1139da6e3b 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -105,8 +105,6 @@ typedef struct {
 
 #define ROUNDUP8(x)  (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
 
-#define ADDRESS_IS_ALIGNED_(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)
-
 #define UFS_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
   CR (a, \
   UFS_PASS_THRU_PRIVATE_DATA, \
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.h 

[edk2-devel] [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() macro.

2023-03-22 Thread Gerd Hoffmann
Drop MtrrLibIsPowerOfTwo function, use the new IS_POW2() macro instead.

The ASSERT() removed (inside MtrrLibIsPowerOfTwo) is superfluous,
another ASSERT() a few lines up in MtrrLibCalculateMtrrs() already
guarantees that Length can not be zero at this point.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c 
b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index e5c862c83d61..dd0b668d7782 100644
--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
@@ -1253,21 +1253,6 @@ MtrrLibLowestType (
   return (MTRR_MEMORY_CACHE_TYPE)Type;
 }
 
-/**
-  Return TRUE when the Operand is exactly power of 2.
-
-  @retval TRUE  Operand is exactly power of 2.
-  @retval FALSE Operand is not power of 2.
-**/
-BOOLEAN
-MtrrLibIsPowerOfTwo (
-  IN UINT64  Operand
-  )
-{
-  ASSERT (Operand != 0);
-  return (BOOLEAN)((Operand & (Operand - 1)) == 0);
-}
-
 /**
   Calculate the subtractive path from vertex Start to Stop.
 
@@ -1638,7 +1623,7 @@ MtrrLibCalculateMtrrs (
   break;
 }
 
-if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && MtrrLibIsPowerOfTwo 
(Length)) {
+if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && IS_POW2 (Length)) {
   if (MtrrLibGetNumberOfTypes (
 Ranges,
 RangeCount,
-- 
2.39.2



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




[edk2-devel] [PATCH v2 3/6] MdePkg/Base.h: Introduce various alignment-related macros

2023-03-22 Thread Gerd Hoffmann
From: Marvin Häuser 

ALIGNOF: Determining the alignment requirement of data types is
crucial to ensure safe memory accesses when parsing untrusted data.

IS_POW2: Determining whether a value is a power of two is important
to verify whether untrusted values are valid alignment values.

IS_ALIGNED: In combination with ALIGNOF data offsets can be verified.
A more general version of the IS_ALIGNED macro previously defined by several 
modules.

ADDRESS_IS_ALIGNED: Variant of IS_ALIGNED for pointers and addresses.
Replaces module-specific definitions throughout the codebase.

ALIGN_VALUE_ADDEND: The addend to align up can be used to directly
determine the required offset for data alignment.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Vitaly Cheptsov 
Signed-off-by: Marvin Häuser 
Signed-off-by: Gerd Hoffmann 
---
 MdePkg/Include/Base.h | 98 ++-
 1 file changed, 97 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index e89c84962ab2..6597e441a6e2 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -758,6 +758,40 @@ typedef UINTN *BASE_LIST;
 #define OFFSET_OF(TYPE, Field)  ((UINTN) &(((TYPE *)0)->Field))
 #endif
 
+/**
+  Returns the alignment requirement of a type.
+
+  @param   TYPE  The name of the type to retrieve the alignment requirement of.
+
+  @return  Alignment requirement, in Bytes, of TYPE.
+**/
+#if defined (__cplusplus)
+//
+// Standard C++ operator.
+//
+#define ALIGNOF(TYPE)  alignof (TYPE)
+#elif defined (__GNUC__) || defined (__clang__) || (defined (_MSC_VER) && 
_MSC_VER >= 1900)
+//
+// All supported versions of GCC and Clang, as well as MSVC 2015 and later,
+// support the standard operator _Alignof.
+//
+#define ALIGNOF(TYPE)  _Alignof (TYPE)
+#elif defined (_MSC_EXTENSIONS)
+//
+// Earlier versions of MSVC, at least MSVC 2008 and later, support the vendor
+// extension __alignof.
+//
+#define ALIGNOF(TYPE)  __alignof (TYPE)
+#else
+//
+// For compilers that do not support inbuilt alignof operators, use OFFSET_OF.
+// CHAR8 is known to have both a size and an alignment requirement of 1 Byte.
+// As such, A must be located exactly at the offset equal to its alignment
+// requirement.
+//
+#define ALIGNOF(TYPE)  OFFSET_OF (struct { CHAR8 C; TYPE A; }, A)
+#endif
+
 /**
   Portable definition for compile time assertions.
   Equivalent to C11 static_assert macro from assert.h.
@@ -793,6 +827,21 @@ STATIC_ASSERT (sizeof (CHAR16)  == 2, "sizeof (CHAR16) 
does not meet UEFI Specif
 STATIC_ASSERT (sizeof (L'A')== 2, "sizeof (L'A') does not meet UEFI 
Specification Data Type requirements");
 STATIC_ASSERT (sizeof (L"A")== 4, "sizeof (L\"A\") does not meet UEFI 
Specification Data Type requirements");
 
+STATIC_ASSERT (ALIGNOF (BOOLEAN) == sizeof (BOOLEAN), "Alignment of BOOLEAN 
does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT8)== sizeof (INT8), "Alignment of INT8 does not 
meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT8)   == sizeof (UINT8), "Alignment of INT16 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT16)   == sizeof (INT16), "Alignment of INT16 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT16)  == sizeof (UINT16), "Alignment of UINT16 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT32)   == sizeof (INT32), "Alignment of INT32 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT32)  == sizeof (UINT32), "Alignment of UINT32 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT64)   == sizeof (INT64), "Alignment of INT64 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT64)  == sizeof (UINT64), "Alignment of UINT64 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (CHAR8)   == sizeof (CHAR8), "Alignment of CHAR8 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (CHAR16)  == sizeof (CHAR16), "Alignment of CHAR16 does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INTN)== sizeof (INTN), "Alignment of INTN does not 
meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINTN)   == sizeof (UINTN), "Alignment of UINTN does 
not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (VOID *)  == sizeof (VOID *), "Alignment of VOID * does 
not meet UEFI Specification Data Type requirements");
+
 //
 // The following three enum types are used to verify that the compiler
 // configuration for enum types is compliant with Section 2.3.1 of the
@@ -816,6 +865,10 @@ STATIC_ASSERT (sizeof (__VERIFY_UINT8_ENUM_SIZE) == 4, 
"Size of enum does not me
 STATIC_ASSERT (sizeof (__VERIFY_UINT16_ENUM_SIZE) == 4, "Size of enum does not 
meet UEFI 

[edk2-devel] [PATCH v2 2/6] OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions

2023-03-22 Thread Gerd Hoffmann
This patch is a preparation for the patches that follow. The
subsequent patches will introduce and integrate new alignment-related
macros, which collide with existing definitions in OvmfPkg.
Temporarily rename them to avoid build failure, till they can be
substituted with the new, shared definitions.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Michael D Kinney 
Reviewed-by: Jiewen Yao 
Acked-by: Tom Lendacky 
---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c   | 6 +++---
 .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index a726498e2792..71a1eaaf0a1d 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -44,7 +44,7 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
 
 STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;
 
-#define IS_ALIGNED(x, y)  x) & ((y) - 1)) == 0))
+#define IS_ALIGNED_(x, y)  x) & ((y) - 1)) == 0))
 
 STATIC
 EFI_STATUS
@@ -60,8 +60,8 @@ AmdSevMemoryAccept (
   // multiple of SIZE_4KB. Use an assert instead of returning an erros since
   // this is an EDK2-internal protocol.
   //
-  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));
-  ASSERT (IS_ALIGNED (Size, SIZE_4KB));
+  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));
+  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));
   ASSERT (Size != 0);
 
   MemEncryptSevSnpPreValidateSystemRam (
diff --git 
a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c 
b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index 4d684964d838..f35bba5deb46 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -20,7 +20,7 @@
 
 #include "SnpPageStateChange.h"
 
-#define IS_ALIGNED(x, y)  x) & (y - 1)) == 0))
+#define IS_ALIGNED_(x, y)  x) & (y - 1)) == 0))
 #define PAGES_PER_LARGE_ENTRY  512
 
 STATIC
@@ -150,7 +150,7 @@ BuildPageStateBuffer (
 //
 // Is this a 2MB aligned page? Check if we can use the Large RMP entry.
 //
-if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&
+if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&
 ((EndAddress - BaseAddress) >= SIZE_2MB))
 {
   RmpPageSize = PvalidatePageSize2MB;
-- 
2.39.2



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




[edk2-devel] [PATCH v2 0/6] MdePkg/Base.h: Introduce various alignment-related macros

2023-03-22 Thread Gerd Hoffmann
v2 changes:
 - rebase to latest master, adapt patches to changes.
 - update macro documentation to use @retval TRUE/FALSE.
 - added patch to use IS_POW2 in MtrrLib.
 - add reviews and acks.

Gerd Hoffmann (3):
  OvmfPkg: Rename IS_ALIGNED macros to avoid name collisions
  OvmfPkg: Consume new alignment-related macros
  UefiCpuPkg/MtrrLib: use new IS_POW2() macro.

Marvin Häuser (3):
  MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions
  MdePkg/Base.h: Introduce various alignment-related macros
  MdeModulePkg: Consume new alignment-related macros

 MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h|  1 -
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h   |  2 -
 MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h   |  1 -
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h  |  2 -
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h |  2 -
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  2 -
 MdeModulePkg/Universal/EbcDxe/EbcExecute.h|  3 +-
 MdePkg/Include/Base.h | 98 ++-
 MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c   |  2 +-
 .../Bus/Ata/AhciPei/AhciPeiPassThru.c |  6 +-
 .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c   | 12 +--
 .../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c|  2 +-
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c  |  4 +-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  6 +-
 MdeModulePkg/Universal/EbcDxe/EbcExecute.c| 36 +++
 OvmfPkg/AmdSevDxe/AmdSevDxe.c |  2 -
 .../X64/SnpPageStateChangeInternal.c  |  1 -
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c  | 17 +---
 18 files changed, 133 insertions(+), 66 deletions(-)

-- 
2.39.2



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




Re: [edk2-devel] [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for non-transient errors

2023-03-22 Thread Wu, Hao A
Thanks Mateusz, the patch looks good to me.
I noticed that there are some check failures in 
https://github.com/tianocore/edk2/pull/4157, could you help to address them?


Hello Baraneedharan Anbazhagan,
Could you help to check if this patch can resolve the issue 
https://bugzilla.tianocore.org/show_bug.cgi?id=4011 when switching back to: 
"#define AHCI_COMMAND_RETRIES 5"?
This change can be accessed for integration at: 
https://patch-diff.githubusercontent.com/raw/tianocore/edk2/pull/4157.patch
Thanks in advance.

Best Regards,
Hao Wu

> -Original Message-
> From: Albecki, Mateusz 
> Sent: Wednesday, March 22, 2023 4:20 AM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz ; Wu, Hao A
> ; Ni, Ray ; Chang, Hunter
> 
> Subject: [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for non-transient errors
> 
> Fix for the recovery logic which causes hdd unlock to fail if user supplies
> incorrect password. Every failed packet used to be recovered which is causing
> the incorrect password to be tried multiple times. This patch series fixes the
> logic to only retry commands that failed due to CRC error.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4011
> 
> Github pull: https://github.com/tianocore/edk2/pull/4157
> 
> Tests:
> - tested basic linux boot from AHCI on qemu
> - tested basic linux boot from AHCI on custom qemu which will fail 50% of the
> DMA commands with CRC error.
>   Observed that all of the packets that failed were successfully retried. 
> Custom
> Qemu: https://github.com/matalbec/qemu/tree/sata_dma_50p_fail
> - additionally Hunter Chang tested and confirmed that the password issue is no
> longer observed.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Hunter Chang 
> 
> Mateusz Albecki (1):
>   MdeModulePkg/Ahci: Skip retry for non-transient errors
> 
>  .../Bus/Ata/AtaAtapiPassThru/AhciMode.c   | 69 +--
>  .../Bus/Ata/AtaAtapiPassThru/AhciMode.h   |  3 +-
>  2 files changed, 67 insertions(+), 5 deletions(-)
> 
> --
> 2.39.1.windows.1



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




[edk2-devel] [edk2-staging/crypto-new-api][PATCH] CryptoPkg: Move ECC feature to OpensslLibFull

2023-03-22 Thread Li, Yi
The purpose is to use OpensslLib to compile drivers that do not
require ECC functions, instead of enabling ECC unconditionally.

Cc: Zhichao Gao 
Cc: Heng Luo 
Signed-off-by: Yi Li 
---
 CryptoPkg/Library/OpensslLib/EcSm2Null.c  | 421 +++
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  49 +-
 .../Library/OpensslLib/OpensslLibFull.inf | 708 ++
 3 files changed, 1131 insertions(+), 47 deletions(-)
 create mode 100644 CryptoPkg/Library/OpensslLib/EcSm2Null.c
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibFull.inf

diff --git a/CryptoPkg/Library/OpensslLib/EcSm2Null.c 
b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
new file mode 100644
index 00..6ae538a3b3
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
@@ -0,0 +1,421 @@
+/** @file
+  Null implementation of EC and SM2 functions called by BaseCryptLib.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+#undef OPENSSL_NO_EC
+
+#include 
+#include 
+#include 
+#include 
+
+void
+EC_GROUP_free (
+  EC_GROUP  *group
+  )
+{
+  ASSERT (FALSE);
+}
+
+int
+EC_GROUP_get_order (
+  const EC_GROUP  *group,
+  BIGNUM  *order,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_GROUP_get_curve_name (
+  const EC_GROUP  *group
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_GROUP_get_curve (
+  const EC_GROUP  *group,
+  BIGNUM  *p,
+  BIGNUM  *a,
+  BIGNUM  *b,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_GROUP_get_degree (
+  const EC_GROUP  *group
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+EC_GROUP *
+EC_GROUP_new_by_curve_name (
+  int  nid
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+EC_POINT *
+EC_POINT_new (
+  const EC_GROUP  *group
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+void
+EC_POINT_free (
+  EC_POINT  *point
+  )
+{
+  ASSERT (FALSE);
+}
+
+void
+EC_POINT_clear_free (
+  EC_POINT  *point
+  )
+{
+  ASSERT (FALSE);
+}
+
+int
+EC_POINT_set_affine_coordinates (
+  const EC_GROUP  *group,
+  EC_POINT*p,
+  const BIGNUM*x,
+  const BIGNUM*y,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_get_affine_coordinates (
+  const EC_GROUP  *group,
+  const EC_POINT  *p,
+  BIGNUM  *x,
+  BIGNUM  *y,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_set_compressed_coordinates (
+  const EC_GROUP  *group,
+  EC_POINT*p,
+  const BIGNUM*x,
+  int y_bit,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_add (
+  const EC_GROUP  *group,
+  EC_POINT*r,
+  const EC_POINT  *a,
+  const EC_POINT  *b,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_invert (
+  const EC_GROUP  *group,
+  EC_POINT*a,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_is_at_infinity (
+  const EC_GROUP  *group,
+  const EC_POINT  *p
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_POINT_is_on_curve (
+  const EC_GROUP  *group,
+  const EC_POINT  *point,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return -1;
+}
+
+int
+EC_POINT_cmp (
+  const EC_GROUP  *group,
+  const EC_POINT  *a,
+  const EC_POINT  *b,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return -1;
+}
+
+int
+EC_POINT_mul (
+  const EC_GROUP  *group,
+  EC_POINT*r,
+  const BIGNUM*n,
+  const EC_POINT  *q,
+  const BIGNUM*m,
+  BN_CTX  *ctx
+  )
+{
+  ASSERT (FALSE);
+  return -0;
+}
+
+EC_KEY *
+EC_KEY_new_by_curve_name (
+  int  nid
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+void
+EC_KEY_free (
+  EC_KEY  *key
+  )
+{
+  ASSERT (FALSE);
+}
+
+EC_KEY *
+EC_KEY_dup (
+  const EC_KEY  *src
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+const EC_GROUP *
+EC_KEY_get0_group (
+  const EC_KEY  *key
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+const EC_POINT *
+EC_KEY_get0_public_key (
+  const EC_KEY  *key
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+int
+EC_KEY_set_public_key (
+  EC_KEY  *key,
+  const EC_POINT  *pub
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_KEY_generate_key (
+  EC_KEY  *key
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+EC_KEY_check_key (
+  const EC_KEY  *key
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+int
+ECDH_compute_key (
+  void*out,
+  size_t  outlen,
+  const EC_POINT  *pub_key,
+  const EC_KEY*ecdh,
+  void *(*KDF)(
+  const void *in,
+  size_t inlen,
+  void *out,
+  size_t *outlen
+  )
+  )
+{
+  ASSERT (FALSE);
+  return 0;
+}
+
+struct ec_key_st *
+EVP_PKEY_get0_EC_KEY (
+  EVP_PKEY  *pkey
+  )
+{
+  ASSERT (FALSE);
+  return NULL;
+}
+
+EC_KEY *
+PEM_read_bio_ECPrivateKey (
+  BIO  *bp,
+  EC_KEY   **key,
+  pem_password_cb  *cb,
+  void *u
+  )
+{
+  ASSERT