Date   

Re: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

Ni, Ray
 

Is this a patch to enable CI in edk2-platforms?

Package maintainers can directly check in changes to edk2-platforms. Then how the CI is triggered?

Will the CI run because of a edk2 pull request?

Thanks,
Ray

-----Original Message-----
From: Tan, Dun <dun.tan@intel.com>
Sent: Wednesday, September 29, 2021 2:38 PM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Kinney, Michael D
<michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
Subject: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

The edk2-platforms.yml contains the necessary github repo that will be
checked out, the platform name to build and the folders in edk2 which
will trigger the CI. The edk2platforms-run-steps.yml contains the main
steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Dun Tan <dun.tan@intel.com>
---
.azurepipelines/edk2-platforms.yml | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms on windows and ubuntu
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1


Re: [`edk2-devel][PATCH V2] UefiPayloadPkg: Build a HOB from bootloader ACPI table

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Dong, Guo <guo.dong@intel.com>
Sent: Wednesday, September 29, 2021 1:19 AM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin
<benjamin.you@intel.com>
Subject: [`edk2-devel][PATCH V2] UefiPayloadPkg: Build a HOB from bootloader ACPI table

From: Guo Dong <guo.dong@intel.com>

V2: Update BuildHobFromAcpi() to return a HOB pointer.

For universal UEFI payload, build a HOB from the ACPI table, so that
other modules could use this info from HOB at very early DXE phase.
This code are shared by universal payload and non universal payload.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
---
UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c | 202
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 176 ++++-----------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 13 +++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 1 +
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 12 ++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 2 +-
6 files changed, 233 insertions(+), 173 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
new file mode 100644
index 0000000000..e5f2a2b124
--- /dev/null
+++ b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
@@ -0,0 +1,202 @@
+/** @file

+

+

+ Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>

+

+ SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include "UefiPayloadEntry.h"

+

+

+/**

+ Find the board related info from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+ @param AcpiBoardInfo Pointer to the acpi board info strucutre

+

+ @retval RETURN_SUCCESS Successfully find out all the required information.

+ @retval RETURN_NOT_FOUND Failed to find the required info.

+

+**/

+RETURN_STATUS

+ParseAcpiInfo (

+ IN UINT64 AcpiTableBase,

+ OUT ACPI_BOARD_INFO *AcpiBoardInfo

+ )

+{

+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;

+ EFI_ACPI_DESCRIPTION_HEADER *Rsdt;

+ UINT32 *Entry32;

+ UINTN Entry32Num;

+ EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;

+ EFI_ACPI_DESCRIPTION_HEADER *Xsdt;

+ UINT64 *Entry64;

+ UINTN Entry64Num;

+ UINTN Idx;

+ UINT32 *Signature;

+ EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;

+ EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE
*MmCfgBase;

+

+ Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;

+ DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));

+ DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));

+

+ //

+ // Search Rsdt First

+ //

+ Fadt = NULL;

+ MmCfgHdr = NULL;

+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);

+ if (Rsdt != NULL) {

+ Entry32 = (UINT32 *)(Rsdt + 1);

+ Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;

+ for (Idx = 0; Idx < Entry32Num; Idx++) {

+ Signature = (UINT32 *)(UINTN)Entry32[Idx];

+ if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

+ DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));

+ }

+

+ if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

+ MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

+ DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));

+ }

+

+ if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

+ goto Done;

+ }

+ }

+ }

+

+ //

+ // Search Xsdt Second

+ //

+ Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);

+ if (Xsdt != NULL) {

+ Entry64 = (UINT64 *)(Xsdt + 1);

+ Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;

+ for (Idx = 0; Idx < Entry64Num; Idx++) {

+ Signature = (UINT32 *)(UINTN)Entry64[Idx];

+ if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

+ DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));

+ }

+

+ if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

+ MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

+ DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));

+ }

+

+ if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

+ goto Done;

+ }

+ }

+ }

+

+ if (Fadt == NULL) {

+ return RETURN_NOT_FOUND;

+ }

+

+Done:

+

+ AcpiBoardInfo->PmCtrlRegBase = Fadt->Pm1aCntBlk;

+ AcpiBoardInfo->PmTimerRegBase = Fadt->PmTmrBlk;

+ AcpiBoardInfo->ResetRegAddress = Fadt->ResetReg.Address;

+ AcpiBoardInfo->ResetValue = Fadt->ResetValue;

+ AcpiBoardInfo->PmEvtBase = Fadt->Pm1aEvtBlk;

+ AcpiBoardInfo->PmGpeEnBase = Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;

+

+ if (MmCfgHdr != NULL) {

+ MmCfgBase =
(EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*)
MmCfgHdr + sizeof (*MmCfgHdr));

+ AcpiBoardInfo->PcieBaseAddress = MmCfgBase->BaseAddress;

+ AcpiBoardInfo->PcieBaseSize = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;

+ } else {

+ AcpiBoardInfo->PcieBaseAddress = 0;

+ AcpiBoardInfo->PcieBaseSize = 0;

+ }

+ DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase));

+ DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBase));

+ DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddress));

+ DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));

+ DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));

+ DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase));

+ DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddress));

+ DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize));

+

+ //

+ // Verify values for proper operation

+ //

+ ASSERT(Fadt->Pm1aCntBlk != 0);

+ ASSERT(Fadt->PmTmrBlk != 0);

+ ASSERT(Fadt->ResetReg.Address != 0);

+ ASSERT(Fadt->Pm1aEvtBlk != 0);

+ ASSERT(Fadt->Gpe0Blk != 0);

+

+ DEBUG_CODE_BEGIN ();

+ BOOLEAN SciEnabled;

+

+ //

+ // Check the consistency of SCI enabling

+ //

+

+ //

+ // Get SCI_EN value

+ //

+ if (Fadt->Pm1CntLen == 4) {

+ SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

+ } else {

+ //

+ // if (Pm1CntLen == 2), use 16 bit IO read;

+ // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback

+ //

+ SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

+ }

+

+ if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&

+ (Fadt->SmiCmd == 0) &&

+ !SciEnabled) {

+ //

+ // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI

+ // table does not provide a means to enable it through FADT->SmiCmd

+ //

+ DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"

+ " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."

+ " This may cause issues in OS.\n"));

+ }

+ DEBUG_CODE_END ();

+

+ return RETURN_SUCCESS;

+}

+

+

+/**

+ Build ACPI board info HOB using infomation from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+

+ @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.

+**/

+ACPI_BOARD_INFO *

+BuildHobFromAcpi (

+ IN UINT64 AcpiTableBase

+ )

+{

+ EFI_STATUS Status;

+ ACPI_BOARD_INFO AcpiBoardInfo;

+ ACPI_BOARD_INFO *NewAcpiBoardInfo;

+

+ NewAcpiBoardInfo = NULL;

+ Status = ParseAcpiInfo (AcpiTableBase, &AcpiBoardInfo);

+ ASSERT_EFI_ERROR (Status);

+ if (!EFI_ERROR (Status)) {

+ NewAcpiBoardInfo = BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (ACPI_BOARD_INFO));

+ ASSERT (NewAcpiBoardInfo != NULL);

+ CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));

+ DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));

+ }

+ return NewAcpiBoardInfo;

+}

+

+

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index ae16f25c7c..a12d9961f1 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -212,167 +212,6 @@ MemInfoCallback (






-/**

- Find the board related info from ACPI table

-

- @param AcpiTableBase ACPI table start address in memory

- @param AcpiBoardInfo Pointer to the acpi board info strucutre

-

- @retval RETURN_SUCCESS Successfully find out all the required information.

- @retval RETURN_NOT_FOUND Failed to find the required info.

-

-**/

-RETURN_STATUS

-ParseAcpiInfo (

- IN UINT64 AcpiTableBase,

- OUT ACPI_BOARD_INFO *AcpiBoardInfo

- )

-{

- EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;

- EFI_ACPI_DESCRIPTION_HEADER *Rsdt;

- UINT32 *Entry32;

- UINTN Entry32Num;

- EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;

- EFI_ACPI_DESCRIPTION_HEADER *Xsdt;

- UINT64 *Entry64;

- UINTN Entry64Num;

- UINTN Idx;

- UINT32 *Signature;

- EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;

- EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE
*MmCfgBase;

-

- Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;

- DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));

- DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));

-

- //

- // Search Rsdt First

- //

- Fadt = NULL;

- MmCfgHdr = NULL;

- Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);

- if (Rsdt != NULL) {

- Entry32 = (UINT32 *)(Rsdt + 1);

- Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;

- for (Idx = 0; Idx < Entry32Num; Idx++) {

- Signature = (UINT32 *)(UINTN)Entry32[Idx];

- if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

- Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

- DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));

- }

-

- if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

- MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

- DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));

- }

-

- if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

- goto Done;

- }

- }

- }

-

- //

- // Search Xsdt Second

- //

- Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);

- if (Xsdt != NULL) {

- Entry64 = (UINT64 *)(Xsdt + 1);

- Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;

- for (Idx = 0; Idx < Entry64Num; Idx++) {

- Signature = (UINT32 *)(UINTN)Entry64[Idx];

- if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

- Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

- DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));

- }

-

- if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

- MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

- DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));

- }

-

- if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

- goto Done;

- }

- }

- }

-

- if (Fadt == NULL) {

- return RETURN_NOT_FOUND;

- }

-

-Done:

-

- AcpiBoardInfo->PmCtrlRegBase = Fadt->Pm1aCntBlk;

- AcpiBoardInfo->PmTimerRegBase = Fadt->PmTmrBlk;

- AcpiBoardInfo->ResetRegAddress = Fadt->ResetReg.Address;

- AcpiBoardInfo->ResetValue = Fadt->ResetValue;

- AcpiBoardInfo->PmEvtBase = Fadt->Pm1aEvtBlk;

- AcpiBoardInfo->PmGpeEnBase = Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;

-

- if (MmCfgHdr != NULL) {

- MmCfgBase =
(EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*)
MmCfgHdr + sizeof (*MmCfgHdr));

- AcpiBoardInfo->PcieBaseAddress = MmCfgBase->BaseAddress;

- AcpiBoardInfo->PcieBaseSize = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;

- } else {

- AcpiBoardInfo->PcieBaseAddress = 0;

- AcpiBoardInfo->PcieBaseSize = 0;

- }

- DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase));

- DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBase));

- DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddress));

- DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));

- DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));

- DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase));

- DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddress));

- DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize));

-

- //

- // Verify values for proper operation

- //

- ASSERT(Fadt->Pm1aCntBlk != 0);

- ASSERT(Fadt->PmTmrBlk != 0);

- ASSERT(Fadt->ResetReg.Address != 0);

- ASSERT(Fadt->Pm1aEvtBlk != 0);

- ASSERT(Fadt->Gpe0Blk != 0);

-

- DEBUG_CODE_BEGIN ();

- BOOLEAN SciEnabled;

-

- //

- // Check the consistency of SCI enabling

- //

-

- //

- // Get SCI_EN value

- //

- if (Fadt->Pm1CntLen == 4) {

- SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

- } else {

- //

- // if (Pm1CntLen == 2), use 16 bit IO read;

- // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback

- //

- SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

- }

-

- if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&

- (Fadt->SmiCmd == 0) &&

- !SciEnabled) {

- //

- // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI

- // table does not provide a means to enable it through FADT->SmiCmd

- //

- DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"

- " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."

- " This may cause issues in OS.\n"));

- }

- DEBUG_CODE_END ();

-

- return RETURN_SUCCESS;

-}

-

-

/**

It will build HOBs based on information from bootloaders.



@@ -387,8 +226,7 @@ BuildHobFromBl (
EFI_STATUS Status;

SYSTEM_TABLE_INFO SysTableInfo;

SYSTEM_TABLE_INFO *NewSysTableInfo;

- ACPI_BOARD_INFO AcpiBoardInfo;

- ACPI_BOARD_INFO *NewAcpiBoardInfo;

+ ACPI_BOARD_INFO *AcpiBoardInfo;

EFI_PEI_GRAPHICS_INFO_HOB GfxInfo;

EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo;

EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo;

@@ -471,20 +309,14 @@ BuildHobFromBl (
//

// Create guid hob for acpi board information

//

- Status = ParseAcpiInfo (SysTableInfo.AcpiTableBase, &AcpiBoardInfo);

- ASSERT_EFI_ERROR (Status);

- if (!EFI_ERROR (Status)) {

- NewAcpiBoardInfo = BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (ACPI_BOARD_INFO));

- ASSERT (NewAcpiBoardInfo != NULL);

- CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));

- DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));

- }

+ AcpiBoardInfo = BuildHobFromAcpi (SysTableInfo.AcpiTableBase);

+ ASSERT (AcpiBoardInfo != NULL);



//

// Parse memory info and build memory HOBs for reserved DRAM and MMIO

//

DEBUG ((DEBUG_INFO , "Building ResourceDescriptorHobs for reserved memory:\n"));

- Status = ParseMemoryInfo (MemInfoCallbackMmio, &AcpiBoardInfo);

+ Status = ParseMemoryInfo (MemInfoCallbackMmio, AcpiBoardInfo);

if (EFI_ERROR(Status)) {

return Status;

}

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 331724c687..9922b56b39 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -204,4 +204,17 @@ FvFindFileByTypeGuid (
IN EFI_GUID *Guid OPTIONAL,

OUT EFI_FFS_FILE_HEADER **FileHeader

);

+

+/**

+ Build ACPI board info HOB using infomation from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+

+ @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.

+**/

+ACPI_BOARD_INFO *

+BuildHobFromAcpi (

+ IN UINT64 AcpiTableBase

+ );

+

#endif

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 8d42925fcd..4c5170d9cc 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -25,6 +25,7 @@
UefiPayloadEntry.c

LoadDxeCore.c

MemoryAllocation.c

+ AcpiTable.c



[Sources.Ia32]

X64/VirtualMemory.h

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 03ad9c457b..7e67cf0f04 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -260,6 +260,8 @@ BuildHobs (
UNIVERSAL_PAYLOAD_EXTRA_DATA *ExtraData;

UINT8 *GuidHob;

EFI_HOB_FIRMWARE_VOLUME *FvHob;

+ UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTable;

+ ACPI_BOARD_INFO *AcpiBoardInfo;



Hob.Raw = (UINT8 *) BootloaderParameter;

MinimalNeededSize = FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);

@@ -351,6 +353,16 @@ BuildHobs (
*DxeFv = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) ExtraData->Entry[0].Base;

ASSERT ((*DxeFv)->FvLength == ExtraData->Entry[0].Size);



+ //

+ // Create guid hob for acpi board information

+ //

+ GuidHob = GetFirstGuidHob(&gUniversalPayloadAcpiTableGuid);

+ if (GuidHob != NULL) {

+ AcpiTable = (UNIVERSAL_PAYLOAD_ACPI_TABLE *) GET_GUID_HOB_DATA (GuidHob);

+ AcpiBoardInfo = BuildHobFromAcpi ((UINT64)AcpiTable->Rsdp);

+ ASSERT (AcpiBoardInfo != NULL);

+ }

+

//

// Update DXE FV information to first fv hob in the hob list, which

// is the empty FvHob created before.

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 3ee449219d..e7e05b744a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -25,6 +25,7 @@
LoadDxeCore.c

MemoryAllocation.c

PrintHob.c

+ AcpiTable.c



[Sources.Ia32]

X64/VirtualMemory.h

@@ -61,7 +62,6 @@
gEfiGraphicsDeviceInfoHobGuid

gUefiAcpiBoardInfoGuid

gEfiSmbiosTableGuid

- gEfiAcpiTableGuid

gUefiSerialPortInfoGuid

gUniversalPayloadExtraDataGuid

gPcdDataBaseHobGuid

--
2.32.0.windows.2


Re: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

Ni, Ray
 

Thanks for providing a very clear commit message.

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Lou, Yun <yun.lou@intel.com>
Sent: Wednesday, September 29, 2021 7:53 PM
To: devel@edk2.groups.io
Cc: Lou, Yun <yun.lou@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek
<lersek@redhat.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
Subject: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 6e2ab79518..e9eba64914 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -153,7 +153,7 @@ CpuInitDataInitialize (
CpuFeaturesData->AcpiCpuData= AcpiCpuData;



CpuStatus = &AcpiCpuData->CpuFeatureInitData.CpuStatus;

- Location = AllocateZeroPool (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus);

+ Location = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus));

ASSERT (Location != NULL);

AcpiCpuData->CpuFeatureInitData.ApLocation = (EFI_PHYSICAL_ADDRESS)(UINTN)Location;



@@ -205,11 +205,11 @@ CpuInitDataInitialize (
//

// Collect valid core count in each package because not all cores are valid.

//

- ThreadCountPerPackage = AllocateZeroPool (sizeof (UINT32) * CpuStatus->PackageCount);

+ ThreadCountPerPackage = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT32) * CpuStatus->PackageCount));

ASSERT (ThreadCountPerPackage != NULL);

CpuStatus->ThreadCountPerPackage = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerPackage;



- ThreadCountPerCore = AllocateZeroPool (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount);

+ ThreadCountPerCore = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus-
MaxCoreCount));
ASSERT (ThreadCountPerCore != NULL);

CpuStatus->ThreadCountPerCore = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerCore;



--
2.28.0.windows.1


Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Yao, Jiewen
 

Right. QemuFwCfgLibMmio - per my understanding.

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Abner
Chang
Sent: Wednesday, September 29, 2021 8:47 PM
To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>;
sami.mujawar@arm.com
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm
<leif@nuviainc.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd
Hoffmann <kraxel@redhat.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>;
Sunil V L <sunilvl@ventanamicro.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,
It should be QemuFwCfgLibMmio instead of QemuFwCfgLibMMIO, right?

Abner

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Yao, Jiewen
Sent: Wednesday, September 29, 2021 8:26 PM
To: devel@edk2.groups.io; sami.mujawar@arm.com
Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Ard
Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm
<leif@nuviainc.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd
Hoffmann <kraxel@redhat.com>; Schaefer, Daniel
<daniel.schaefer@hpe.com>; Sunil V L <sunilvl@ventanamicro.com>; nd
<nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate QemuFwCfgLib to OvmfPkg

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc
you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is
the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance
name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@intel.com>
Cc: Chang, Abner <abner.chang@hpe.com>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm
<leif@nuviainc.com>;
Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann
<kraxel@redhat.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>; Sunil
V L
<sunilvl@ventanamicro.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in
INVALID URI REMOVED
__;!!NpxR!zMRKC5N87Eb6j69O6lJZ1hVaDVHrnj_21pwNznZx6ZAtLm0Z948atj
NrWepfxQ0$
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names
and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@intel.com> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@arm.com> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and
rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@hpe.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
>> Cc: Sunil V L <sunilvl@ventanamicro.com>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern
similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc
b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by
the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development
LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64
((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>











Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Abner Chang
 

Hi Jiewen,
It should be QemuFwCfgLibMmio instead of QemuFwCfgLibMMIO, right?

Abner

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Yao, Jiewen
Sent: Wednesday, September 29, 2021 8:26 PM
To: devel@edk2.groups.io; sami.mujawar@arm.com
Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Ard
Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm
<leif@nuviainc.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd
Hoffmann <kraxel@redhat.com>; Schaefer, Daniel
<daniel.schaefer@hpe.com>; Sunil V L <sunilvl@ventanamicro.com>; nd
<nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate QemuFwCfgLib to OvmfPkg

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc
you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is
the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance
name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@intel.com>
Cc: Chang, Abner <abner.chang@hpe.com>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm
<leif@nuviainc.com>;
Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann
<kraxel@redhat.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>; Sunil
V L
<sunilvl@ventanamicro.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in
INVALID URI REMOVED
__;!!NpxR!zMRKC5N87Eb6j69O6lJZ1hVaDVHrnj_21pwNznZx6ZAtLm0Z948atj
NrWepfxQ0$
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names
and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@intel.com> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@arm.com> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and
rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@hpe.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
>> Cc: Sunil V L <sunilvl@ventanamicro.com>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern
similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc
b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by
the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development
LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64
((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>








Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Yao, Jiewen
 

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@intel.com>
Cc: Chang, Abner <abner.chang@hpe.com>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@kernel.org>; Leif Lindholm <leif@nuviainc.com>;
Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann
<kraxel@redhat.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>; Sunil V L
<sunilvl@ventanamicro.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in https://edk2-
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@intel.com> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@arm.com> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@hpe.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
>> Cc: Sunil V L <sunilvl@ventanamicro.com>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice
Lib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice
Lib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>





Re: [PATCH v1 0/4] Set default Makefile name

Bob Feng
 

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
Sent: Wednesday, September 29, 2021 7:44 PM
To: Pierre.Gondois@arm.com; devel@edk2.groups.io; Liming Gao <gaoliming@byosoft.com.cn>; Sami Mujawar <sami.mujawar@arm.com>
Subject: Re: [edk2-devel] [PATCH v1 0/4] Set default Makefile name

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Pierre.Gondois@arm.com <Pierre.Gondois@arm.com>
Sent: Thursday, September 23, 2021 4:59 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Sami Mujawar <sami.mujawar@arm.com>
Subject: [PATCH v1 0/4] Set default Makefile name

From: Pierre Gondois <Pierre.Gondois@arm.com>

A Makefile name is not set in BaseTools when only building modules or libraries. This patch-set sets a default Makefile name for the "build" command.

The patch-set also:
- Removes unsused Makefile variables
- Removes hard-coded references to "target.txt" and "tools_def.txt"

The changes can be seen at: https://github.com/PierreARM/edk2/tree/1868_BaseTools_build_py_corrections_v1

Pierre Gondois (4):
BaseTools/GenMake: Use ToolDefinition as fallback option
BaseTools/build: Set MakefileName
BaseTools: Remove Makefile/MakefileName fields
BaseTools: Remove hard-coded strings for target and tools_def

BaseTools/Source/Python/AutoGen/GenMake.py | 8 ++++----
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 1 -
BaseTools/Source/Python/GenFds/GenFds.py | 4 ++--
.../Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++--
BaseTools/Source/Python/TargetTool/TargetTool.py | 3 ++-
BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 --
BaseTools/Source/Python/Workspace/DscBuildData.py | 9 ++++-----
BaseTools/Source/Python/build/build.py | 11 ++++-------
8 files changed, 18 insertions(+), 24 deletions(-)

--
2.17.1


[PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

Jason Lou
 

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 +++-=
--
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ=
e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 6e2ab79518..e9eba64914 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -153,7 +153,7 @@ CpuInitDataInitialize (
CpuFeaturesData->AcpiCpuData=3D AcpiCpuData;=0D
=0D
CpuStatus =3D &AcpiCpuData->CpuFeatureInitData.CpuStatus;=0D
- Location =3D AllocateZeroPool (sizeof (EFI_CPU_PHYSICAL_LOCATION) * Numb=
erOfCpus);=0D
+ Location =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (EFI_CPU_PHYSICAL_=
LOCATION) * NumberOfCpus));=0D
ASSERT (Location !=3D NULL);=0D
AcpiCpuData->CpuFeatureInitData.ApLocation =3D (EFI_PHYSICAL_ADDRESS)(UI=
NTN)Location;=0D
=0D
@@ -205,11 +205,11 @@ CpuInitDataInitialize (
//=0D
// Collect valid core count in each package because not all cores are va=
lid.=0D
//=0D
- ThreadCountPerPackage =3D AllocateZeroPool (sizeof (UINT32) * CpuStatus-=
PackageCount);=0D
+ ThreadCountPerPackage =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT=
32) * CpuStatus->PackageCount));=0D
ASSERT (ThreadCountPerPackage !=3D NULL);=0D
CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Thread=
CountPerPackage;=0D
=0D
- ThreadCountPerCore =3D AllocateZeroPool (sizeof (UINT8) * CpuStatus->Pac=
kageCount * CpuStatus->MaxCoreCount);=0D
+ ThreadCountPerCore =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT8) =
* CpuStatus->PackageCount * CpuStatus->MaxCoreCount));=0D
ASSERT (ThreadCountPerCore !=3D NULL);=0D
CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCou=
ntPerCore;=0D
=0D
--=20
2.28.0.windows.1


Re: [PATCH v1 0/4] Set default Makefile name

Bob Feng
 

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Pierre.Gondois@arm.com <Pierre.Gondois@arm.com>
Sent: Thursday, September 23, 2021 4:59 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Sami Mujawar <sami.mujawar@arm.com>
Subject: [PATCH v1 0/4] Set default Makefile name

From: Pierre Gondois <Pierre.Gondois@arm.com>

A Makefile name is not set in BaseTools when only building modules or libraries. This patch-set sets a default Makefile name for the "build" command.

The patch-set also:
- Removes unsused Makefile variables
- Removes hard-coded references to "target.txt" and "tools_def.txt"

The changes can be seen at: https://github.com/PierreARM/edk2/tree/1868_BaseTools_build_py_corrections_v1

Pierre Gondois (4):
BaseTools/GenMake: Use ToolDefinition as fallback option
BaseTools/build: Set MakefileName
BaseTools: Remove Makefile/MakefileName fields
BaseTools: Remove hard-coded strings for target and tools_def

BaseTools/Source/Python/AutoGen/GenMake.py | 8 ++++----
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 1 -
BaseTools/Source/Python/GenFds/GenFds.py | 4 ++--
.../Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++--
BaseTools/Source/Python/TargetTool/TargetTool.py | 3 ++-
BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 --
BaseTools/Source/Python/Workspace/DscBuildData.py | 9 ++++-----
BaseTools/Source/Python/build/build.py | 11 ++++-------
8 files changed, 18 insertions(+), 24 deletions(-)

--
2.17.1


Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Sami Mujawar
 

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/v/release%2F2.20/4_naming_conventions/42_file_names and therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@intel.com> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen

在 2021年9月29日,下午5:45,Sami Mujawar <Sami.Mujawar@arm.com> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@hpe.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
>> Cc: Sunil V L <sunilvl@ventanamicro.com>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern similar to OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
>> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
>> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
>> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
>> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by the build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32 ((UINT32)&Access));
>


Re: 回复: [edk2-devel] [PATCH v3 0/2] BaseTools: Switch to downloading the ARM and AARCH64 compilers from Arm's site

Bob Feng
 

PR 2020 failed because it has an additional commit "Merge branch 'master' into BaseTools_Arm"

Create a new PR https://github.com/tianocore/edk2/pull/2029

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Wednesday, September 29, 2021 9:19 AM
To: 'Leif Lindholm' <leif@nuviainc.com>; devel@edk2.groups.io
Cc: 'Rebecca Cran' <rebecca@nuviainc.com>; Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>; 'Sean Brogan' <sean.brogan@microsoft.com>; 'Sami Mujawar' <sami.mujawar@arm.com>; 'Ard Biesheuvel' <ardb+tianocore@kernel.org>
Subject: 回复: 回复: [edk2-devel] [PATCH v3 0/2] BaseTools: Switch to downloading the ARM and AARCH64 compilers from Arm's site

Create PR https://github.com/tianocore/edk2/pull/2020.

Thanks
Liming
-----邮件原件-----
发件人: Leif Lindholm <leif@nuviainc.com>
发送时间: 2021年9月28日 18:49
收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
抄送: 'Rebecca Cran' <rebecca@nuviainc.com>; 'Bob Feng'
<bob.c.feng@intel.com>; 'Yuwei Chen' <yuwei.chen@intel.com>; 'Sean
Brogan' <sean.brogan@microsoft.com>; 'Sami Mujawar'
<sami.mujawar@arm.com>; 'Ard Biesheuvel' <ardb+tianocore@kernel.org>
主题: Re: 回复: [edk2-devel] [PATCH v3 0/2] BaseTools: Switch to
downloading the ARM and AARCH64 compilers from Arm's site

Could one of the BaseTools maintainers merge this set?

On Fri, Sep 24, 2021 at 08:44:42 +0800, gaoliming wrote:
Leif:
I gave my Acked-by for this patch set V2. I think it can be merged now.

Thanks
Liming
-----邮件原件-----
发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Leif
Lindholm
发送时间: 2021年9月24日 2:17
收件人: Rebecca Cran <rebecca@nuviainc.com>
抄送: devel@edk2.groups.io; Bob Feng <bob.c.feng@intel.com>; Liming
Gao
<gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>;
Sean
Brogan <sean.brogan@microsoft.com>; Sami Mujawar
<sami.mujawar@arm.com>; Ard Biesheuvel
<ardb+tianocore@kernel.org>
主题: Re: [edk2-devel] [PATCH v3 0/2] BaseTools: Switch to
downloading
the
ARM and AARCH64 compilers from Arm's site

Hi Rebecca,

I think I already gave v2 an Acked-by, but just in case:
Acked-by: Leif Lindholm <leif@nuviainc.com>

Bob, Liming, Yuwei - any comments?

/
Leif

Thu, Sep 23, 2021 at 10:09:55 -0600, Rebecca Cran wrote:
BaseTools/Bin/gcc_[arm,aarch64]_linux_ext_dep.yaml downloads GCC
releases
from
https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02 .

As indicated in the URL, those builds are from 2019 because
Linaro no longer do GCC releases, with that task having moved to Arm.

The Arm GCC page is
https://developer.arm.com/tools-and-software/open-source-software/deve
l
oper-tools/gnu-toolchain/gnu-a/downloads,
with the latest release being 10.3-2021.07.

gcc_aarch64_linux_ext_dep.yaml is used when setting up a CI
environment using the stuart tools.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3594
PR: https://github.com/tianocore/edk2/pull/1909

Changes from v2 to v3:

Fixed the author to be @nuviainc.com instead of @bsdio.com.

Rebecca Cran (2):
BaseTools: Switch to downloading the ARM compiler from Arm's site
BaseTools: Switch to downloading the AARCH64 compiler from
Arm's
site

BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml | 10
+++++-----
BaseTools/Bin/gcc_arm_linux_ext_dep.yaml |
10
+++++-----
BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py | 4
++--
3 files changed, 12 insertions(+), 12 deletions(-)

--
2.31.1









Re: [PATCH v2 0/2] BaseTools: Switch to downloading the ARM/AARCH64 compiler from Arm's site

Bob Feng
 

Acked-by: Bob Feng <bob.c.feng@intel.com>

Sorry for the late response.

-----Original Message-----
From: Rebecca Cran <rebecca@bsdio.com>
Sent: Monday, August 30, 2021 1:15 PM
To: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; Sami Mujawar <sami.mujawar@arm.com>; Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Rebecca Cran <rebecca@bsdio.com>; devel@edk2.groups.io
Subject: [PATCH v2 0/2] BaseTools: Switch to downloading the ARM/AARCH64 compiler from Arm's site

Linaro no longer do gcc releases - Arm creates them now.

Update the gcc_[arm,aarch64]_linux_ext_dep.yaml files in BaseTools/Bin to switch from Linaro's old release to the latest gcc 10.3-2021.07 release from Arm and fix LinuxGcc5ToolChain.py with the new gcc prefix.


Rebecca Cran (2):
BaseTools: Switch to downloading the ARM compiler from Arm's site
BaseTools: Switch to downloading the AARCH64 compiler from Arm's site

BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml | 10 +++++-----
BaseTools/Bin/gcc_arm_linux_ext_dep.yaml | 10 +++++-----
BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)

--
2.31.1


Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Yao, Jiewen
 

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen

在 2021年9月29日,下午5:45,Sami Mujawar <Sami.Mujawar@arm.com> 写道:

Hi Abner,

Thank you for this patch.

I have a minor suggestion marked inline as [SAMI].

Regards,

Sami Mujawar


On 28/09/2021 09:31 AM, Abner Chang wrote:
Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
.../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
.../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
4 files changed, 8 insertions(+), 8 deletions(-)
rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
[SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern similar to OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 07f9699c79..6c949fd559 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -59,7 +59,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
- QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index cf7a2b4463..64035a948d 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -57,7 +57,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
- QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
similarity index 87%
rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
index f3cc827907..8101fac03f 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
@@ -23,17 +23,16 @@
# The following information is for reference only and not required by the build
# tools.
#
-# VALID_ARCHITECTURES = ARM AARCH64
+# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
#
[Sources]
- QemuFwCfgLib.c
+ QemuFwCfgLibMMIO.c
[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
- ArmVirtPkg/ArmVirtPkg.dec
[LibraryClasses]
BaseLib
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
similarity index 93%
rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
index e2ac4108d1..b953f2eb6c 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
@@ -4,6 +4,7 @@
Copyright (C) 2013 - 2014, Red Hat, Inc.
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -239,7 +240,7 @@ MmioReadBytes (
UINT8 *Ptr;
UINT8 *End;
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
Left = Size & 7;
#else
Left = Size & 3;
@@ -249,7 +250,7 @@ MmioReadBytes (
Ptr = Buffer;
End = Ptr + Size;
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
while (Ptr < End) {
*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
Ptr += 8;
@@ -322,7 +323,7 @@ DmaTransferBytes (
//
// This will fire off the transfer.
//
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access));
#else
MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32 ((UINT32)&Access));


Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Sami Mujawar
 

Hi Abner,

Thank you for this patch.

I have a minor suggestion marked inline as [SAMI].

Regards,

Sami Mujawar


On 28/09/2021 09:31 AM, Abner Chang wrote:
Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
.../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
.../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
4 files changed, 8 insertions(+), 8 deletions(-)
rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
[SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern similar to OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 07f9699c79..6c949fd559 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -59,7 +59,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
- QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index cf7a2b4463..64035a948d 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -57,7 +57,7 @@
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
- QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
similarity index 87%
rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
index f3cc827907..8101fac03f 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
@@ -23,17 +23,16 @@
# The following information is for reference only and not required by the build
# tools.
#
-# VALID_ARCHITECTURES = ARM AARCH64
+# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
#
[Sources]
- QemuFwCfgLib.c
+ QemuFwCfgLibMMIO.c
[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
- ArmVirtPkg/ArmVirtPkg.dec
[LibraryClasses]
BaseLib
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
similarity index 93%
rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
index e2ac4108d1..b953f2eb6c 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
@@ -4,6 +4,7 @@
Copyright (C) 2013 - 2014, Red Hat, Inc.
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -239,7 +240,7 @@ MmioReadBytes (
UINT8 *Ptr;
UINT8 *End;
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
Left = Size & 7;
#else
Left = Size & 3;
@@ -249,7 +250,7 @@ MmioReadBytes (
Ptr = Buffer;
End = Ptr + Size;
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
while (Ptr < End) {
*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
Ptr += 8;
@@ -322,7 +323,7 @@ DmaTransferBytes (
//
// This will fire off the transfer.
//
-#ifdef MDE_CPU_AARCH64
+#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access));
#else
MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32 ((UINT32)&Access));


[Patch V2 1/1] BaseTools: Change RealPath to AbsPath

Yuwei Chen
 

Currently the realpath is used when parse modules, which shows the
path with a drive letter in build log. In Windows 'subst' comand is
used to associates a path with a drive letter, when use the mapped
drive letter for build, with realpath function the build log will
have different disk letter info which will cause confusion. In this
situation, if use adspath function to show the path info, it will keep
same letter with the mapped drive letter, which avoids confusion.
This patch modifies the realpath to abspath.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
.gitignore | 1 +
BaseTools/Source/Python/Ecc/Check.py | 2 +-
BaseTools/Source/Python/Ecc/EccMain.py | 4 ++--
BaseTools/Source/Python/Ecc/c.py | 2 +-
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 4 ++--
BaseTools/Source/Python/GenFds/GenFds.py | 6 +++---
6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1dd30c141066..41471df06ba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ Build/
__pycache__/
tags/
.vscode/
+/bin/
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 33060db5f27a..ba04e6e0619d 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -332,7 +332,7 @@ class Check(object):
for Dir in Dirnames:
Dirname = os.path.join(Dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirnames.remove(Dir)
diff --git a/BaseTools/Source/Python/Ecc/EccMain.py b/BaseTools/Source/Python/Ecc/EccMain.py
index 72edbea3b883..e7d44f57f1b4 100644
--- a/BaseTools/Source/Python/Ecc/EccMain.py
+++ b/BaseTools/Source/Python/Ecc/EccMain.py
@@ -105,7 +105,7 @@ class Ecc(object):

def InitDefaultConfigIni(self):
paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
- paths = (os.path.realpath('config.ini'),) + tuple(paths)
+ paths = (os.path.abspath('config.ini'),) + tuple(paths)
for path in paths:
if os.path.exists(path):
self.ConfigFile = path
@@ -183,7 +183,7 @@ class Ecc(object):
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 4a82e5e76003..313d6b088c12 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -508,7 +508,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
for Dir in dirnames:
Dirname = os.path.join(dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
dirnames.remove(Dir)
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 20573ca28d2f..568efb6d7685 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -707,8 +707,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileName,
'DEBUG'
)
- OutputPath = os.path.realpath(OutputPath)
- DebugPath = os.path.realpath(DebugPath)
+ OutputPath = os.path.abspath(OutputPath)
+ DebugPath = os.path.abspath(DebugPath)
return OutputPath, DebugPath

## __GenSimpleFileSection__() method
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index ae3e776a5540..7f266e163c73 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -153,7 +153,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)

if FdfFilename[0:2] == '..':
- FdfFilename = os.path.realpath(FdfFilename)
+ FdfFilename = os.path.abspath(FdfFilename)
if not os.path.isabs(FdfFilename):
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
@@ -175,7 +175,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)

if ActivePlatform[0:2] == '..':
- ActivePlatform = os.path.realpath(ActivePlatform)
+ ActivePlatform = os.path.abspath(ActivePlatform)

if not os.path.isabs (ActivePlatform):
ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
@@ -299,7 +299,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
for Key in GenFdsGlobalVariable.OutputDirDict:
OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
if OutputDir[0:2] == '..':
- OutputDir = os.path.realpath(OutputDir)
+ OutputDir = os.path.abspath(OutputDir)

if OutputDir[1] != ':':
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
--
2.26.1.windows.1


Re: [PATCH 1/1] SecurityPkg: Fix SecureBootDefaultKeysDxe failed to start

Grzegorz Bernacki
 

Hi,

Looks good to me...
Reviewed-by: Grzegorz Bernacki <gjb@semihalf.com>

pon., 27 wrz 2021 o 09:48 Nhi Pham via groups.io
<nhi=os.amperecomputing.com@groups.io> napisał(a):


The dbt and dbx keys are optional, the driver entry should return
EFI_SUCCESS to start if they are not found in the firmware flash. This
patch is to fix it and update the description of retval as well.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
---
SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c | 21 +++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c
index f51d5243b7e8..10bdb1b58e6f 100644
--- a/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c
+++ b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c
@@ -3,6 +3,7 @@

Copyright (c) 2021, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2021, Semihalf All rights reserved.<BR>
+Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -23,10 +24,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
@param[in] ImageHandle The image handle of the driver.
@param[in] SystemTable The system table.

- @retval EFI_ALREADY_STARTED The driver already exists in system.
- @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of resources.
- @retval EFI_SUCCESS All the related protocols are installed on the driver.
- @retval Others Fail to get the SecureBootEnable variable.
+ @retval EFI_SUCCESS The secure default keys are initialized successfully.
+ @retval EFI_UNSUPPORTED One of the secure default keys already exists.
+ @retval EFI_NOT_FOUND One of the PK, KEK, or DB default keys is not found.
+ @retval Others Fail to initialize the secure default keys.

**/
EFI_STATUS
@@ -56,14 +57,20 @@ SecureBootDefaultKeysEntryPoint (
}

Status = SecureBootInitDbtDefault ();
- if (EFI_ERROR (Status)) {
+ if (Status == EFI_NOT_FOUND) {
DEBUG ((DEBUG_INFO, "%a: dbtDefault not initialized\n", __FUNCTION__));
+ } else if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Cannot initialize dbtDefault: %r\n", __FUNCTION__, Status));
+ return Status;
}

Status = SecureBootInitDbxDefault ();
- if (EFI_ERROR (Status)) {
+ if (Status == EFI_NOT_FOUND) {
DEBUG ((DEBUG_INFO, "%a: dbxDefault not initialized\n", __FUNCTION__));
+ } else if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Cannot initialize dbxDefault: %r\n", __FUNCTION__, Status));
+ return Status;
}

- return Status;
+ return EFI_SUCCESS;
}
--
2.17.1






[PATCH] MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()

Ma, Hua
 

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

Currently, CoreLocateHandleBuffer() follows three steps:
1) get the size of protocol database firstly
2) allocate the buffer based on the size
3) get the protocol database into the buffer
There is no lock protection for the whole three steps. If a new protocol
added in step 2) by other task, e.g. (event timer handle USB device
hotplug). The size of protocol database may be increased and cannot fit
into the previous buffer in step 3). The protocol database cannot be
returned successfully, EFI_BUFFER_TOO_SMALL error will be returned.

This patch adds the lock to protect the whole three steps.
It can make sure the correct protocol database be returned.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
---
MdeModulePkg/Core/Dxe/Hand/Locate.c | 64 +++++++++++++++++++++++------
1 file changed, 51 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c
index be17f4cbc3..4987c046c6 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Locate.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c
@@ -86,7 +86,8 @@ CoreGetNextLocateByProtocol (


/**
- Locates the requested handle(s) and returns them in Buffer.
+ Internal function for locating the requested handle(s) and returns them in Buffer.
+ The caller should already have acquired the ProtocolLock.

@param SearchType The type of search to perform to locate the
handles
@@ -104,8 +105,7 @@ CoreGetNextLocateByProtocol (

**/
EFI_STATUS
-EFIAPI
-CoreLocateHandle (
+InternalCoreLocateHandle (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
@@ -143,11 +143,6 @@ CoreLocateHandle (
ResultBuffer = (IHANDLE **) Buffer;
Status = EFI_SUCCESS;

- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
//
// Get the search function based on type
//
@@ -190,7 +185,6 @@ CoreLocateHandle (
}

if (EFI_ERROR(Status)) {
- CoreReleaseProtocolLock ();
return Status;
}

@@ -247,10 +241,47 @@ CoreLocateHandle (
}
}

- CoreReleaseProtocolLock ();
return Status;
}

+/**
+ Locates the requested handle(s) and returns them in Buffer.
+
+ @param SearchType The type of search to perform to locate the
+ handles
+ @param Protocol The protocol to search for
+ @param SearchKey Dependant on SearchType
+ @param BufferSize On input the size of Buffer. On output the
+ size of data returned.
+ @param Buffer The buffer to return the results in
+
+ @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
+ returned in BufferSize.
+ @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_SUCCESS Successfully found the requested handle(s) and
+ returns them in Buffer.
+
+**/
+EFI_STATUS
+EFIAPI
+CoreLocateHandle (
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,
+ IN EFI_GUID *Protocol OPTIONAL,
+ IN VOID *SearchKey OPTIONAL,
+ IN OUT UINTN *BufferSize,
+ OUT EFI_HANDLE *Buffer
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Lock the protocol database
+ //
+ CoreAcquireProtocolLock ();
+ Status = InternalCoreLocateHandle(SearchType, Protocol, SearchKey, BufferSize, Buffer);
+ CoreReleaseProtocolLock ();
+ return Status;
+}


/**
@@ -610,7 +641,6 @@ Done:
return Status;
}

-
/**
Function returns an array of handles that support the requested protocol
in a buffer allocated from pool. This is a version of CoreLocateHandle()
@@ -657,7 +687,12 @@ CoreLocateHandleBuffer (
BufferSize = 0;
*NumberHandles = 0;
*Buffer = NULL;
- Status = CoreLocateHandle (
+
+ //
+ // Lock the protocol database
+ //
+ CoreAcquireProtocolLock();
+ Status = InternalCoreLocateHandle (
SearchType,
Protocol,
SearchKey,
@@ -674,15 +709,17 @@ CoreLocateHandleBuffer (
if (Status != EFI_INVALID_PARAMETER) {
Status = EFI_NOT_FOUND;
}
+ CoreReleaseProtocolLock ();
return Status;
}

*Buffer = AllocatePool (BufferSize);
if (*Buffer == NULL) {
+ CoreReleaseProtocolLock ();
return EFI_OUT_OF_RESOURCES;
}

- Status = CoreLocateHandle (
+ Status = InternalCoreLocateHandle (
SearchType,
Protocol,
SearchKey,
@@ -695,6 +732,7 @@ CoreLocateHandleBuffer (
*NumberHandles = 0;
}

+ CoreReleaseProtocolLock ();
return Status;
}

--
2.32.0.windows.2


Re: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

duntan
 

Hi all,

Since I don't have the administrator access of Tiano edk2 CI, I can't create a new pipeline based on my .yml file to test my script. So I have to copy the content in edk2-platforms.yml to Windows-VS2019.yml and change file in the included path in .yml file to trigger the PR CI and verify whether the edk2platforms CI test can pass. Here is the PR link and the azure pipeline CI link.
https://github.com/tianocore/edk2/pull/2027
https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=30289&view=results

Thanks,
Dun

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of duntan
Sent: Wednesday, September 29, 2021 2:38 PM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
Subject: [edk2-devel] [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

The edk2-platforms.yml contains the necessary github repo that will be checked out, the platform name to build and the folders in edk2 which will trigger the CI. The edk2platforms-run-steps.yml contains the main steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Dun Tan <dun.tan@intel.com>
---
.azurepipelines/edk2-platforms.yml | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms
+on windows and ubuntu # # Copyright (c) 2021, Intel Corporation. All
+rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent ##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build # # Copyright (c) 2021,
+Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier:
+BSD-2-Clause-Patent ##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1


[PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

duntan
 

The edk2-platforms.yml contains the necessary github repo that will be
checked out, the platform name to build and the folders in edk2 which
will trigger the CI. The edk2platforms-run-steps.yml contains the main
steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Dun Tan <dun.tan@intel.com>
---
.azurepipelines/edk2-platforms.yml | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms on windows and ubuntu
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1


[`edk2-devel][PATCH] UefiPayloadPkg: Remove asm code and sharing libraries

Guo Dong
 

From: Guo Dong <guo.dong@intel.com>

Remove asm code used for payload entry.
Use patchable PCD instead a fixed PCD PcdPayloadStackTop to avoid
potential conflict.

Based on the removal, use same HobLib regardless UNIVERSAL_PAYLOAD.
Use same PlatformHookLib regardless UNIVERSAL_PAYLOAD. The original
PlatformHookLib was removed and UniversalPayloadPlatformHookLib was
rename to new PlatformHookLib.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
---
UefiPayloadPkg/Include/Library/BlParseLib.h =
| 5 ++---
UefiPayloadPkg/Library/CbParseLib/CbParseLib.c =
| 6 ++++--
UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf =
| 4 ++--
UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c =
| 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------=
------------------------------------------
UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf =
| 18 ++++++++++--------
UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf =
| 4 ++--
UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c =
| 95 --------------------------------------------------------------------=
---------------------------
UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf=
| 40 ----------------------------------------
UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm =
| 46 ----------------------------------------------
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c =
| 30 +++++++++++++++++++++++-------
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h =
| 1 +
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf =
| 5 ++---
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf =
| 1 -
UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm =
| 47 -----------------------------------------------
UefiPayloadPkg/UefiPayloadPkg.dec =
| 4 ++--
UefiPayloadPkg/UefiPayloadPkg.dsc =
| 10 +---------
16 files changed, 105 insertions(+), 321 deletions(-)

diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/I=
nclude/Library/BlParseLib.h
index 20a526d15c..1244190d4e 100644
--- a/UefiPayloadPkg/Include/Library/BlParseLib.h
+++ b/UefiPayloadPkg/Include/Library/BlParseLib.h
@@ -2,7 +2,7 @@
This library will parse the coreboot table in memory and extract those r=
equired=0D
information.=0D
=0D
- Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>=0D
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
@@ -16,8 +16,7 @@
#ifndef __BOOTLOADER_PARSE_LIB__=0D
#define __BOOTLOADER_PARSE_LIB__=0D
=0D
-#define GET_BOOTLOADER_PARAMETER() (*(UINTN *)(UINTN)(PcdGet32(PcdPay=
loadStackTop) - sizeof(UINT64)))=0D
-#define SET_BOOTLOADER_PARAMETER(Value) GET_BOOTLOADER_PARAMETER()=3DValue=
=0D
+#define GET_BOOTLOADER_PARAMETER() PcdGet64 (PcdBootloaderParameter)=
=0D
=0D
typedef RETURN_STATUS \=0D
(*BL_MEM_INFO_CALLBACK) (MEMROY_MAP_ENTRY *MemoryMapEntry, VOID *P=
aram);=0D
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c b/UefiPayloadPk=
g/Library/CbParseLib/CbParseLib.c
index 4e23cff50e..4f90687e40 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -2,7 +2,7 @@
This library will parse the coreboot table in memory and extract those r=
equired=0D
information.=0D
=0D
- Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>=0D
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
@@ -140,6 +140,7 @@ GetParameterBase (
UINT8 *TmpPtr;=0D
UINT8 *CbTablePtr;=0D
UINTN Idx;=0D
+ EFI_STATUS Status;=0D
=0D
//=0D
// coreboot could pass coreboot table to UEFI payload=0D
@@ -193,7 +194,8 @@ GetParameterBase (
return NULL;=0D
}=0D
=0D
- SET_BOOTLOADER_PARAMETER ((UINT32)(UINTN)CbTablePtr);=0D
+ PcdSet64S (PcdBootloaderParameter, (UINTN)CbTablePtr);=0D
+ ASSERT_EFI_STATUS (Status);=0D
=0D
return CbTablePtr;=0D
}=0D
diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf b/UefiPayload=
Pkg/Library/CbParseLib/CbParseLib.inf
index 52e3ad2054..cf81697703 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
@@ -1,7 +1,7 @@
## @file=0D
# Coreboot Table Parse Library.=0D
#=0D
-# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>=
=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
##=0D
@@ -36,4 +36,4 @@
PcdLib=0D
=0D
[Pcd]=0D
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D
+ gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D
diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c b/Uef=
iPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
index d8453e5957..004fcd8b7c 100644
--- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
+++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
@@ -1,29 +1,34 @@
/** @file=0D
Platform Hook Library instance for UART device.=0D
=0D
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>=0D
+ Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
=0D
#include <Base.h>=0D
-#include <Uefi/UefiBaseType.h>=0D
-#include <Library/PciLib.h>=0D
+#include <PiDxe.h>=0D
+#include <UniversalPayload/SerialPortInfo.h>=0D
#include <Library/PlatformHookLib.h>=0D
-#include <Library/BlParseLib.h>=0D
#include <Library/PcdLib.h>=0D
+#include <Library/HobLib.h>=0D
=0D
-typedef struct {=0D
- UINT16 VendorId; ///< Vendor ID to match the PCI device. The =
value 0xFFFF terminates the list of entries.=0D
- UINT16 DeviceId; ///< Device ID to match the PCI device=0D
- UINT32 ClockRate; ///< UART clock rate. Set to 0 for default c=
lock rate of 1843200 Hz=0D
- UINT64 Offset; ///< The byte offset into to the BAR=0D
- UINT8 BarIndex; ///< Which BAR to get the UART base address=0D
- UINT8 RegisterStride; ///< UART register stride in bytes. Set to 0=
for default register stride of 1 byte.=0D
- UINT16 ReceiveFifoDepth; ///< UART receive FIFO depth in bytes. Set to=
0 for a default FIFO depth of 16 bytes.=0D
- UINT16 TransmitFifoDepth; ///< UART transmit FIFO depth in bytes. Set t=
o 0 for a default FIFO depth of 16 bytes.=0D
- UINT8 Reserved[2];=0D
-} PCI_SERIAL_PARAMETER;=0D
+=0D
+/** Library Constructor=0D
+=0D
+ @retval RETURN_SUCCESS Success.=0D
+**/=0D
+EFI_STATUS=0D
+EFIAPI=0D
+PlatformHookSerialPortConstructor (=0D
+ VOID=0D
+ )=0D
+{=0D
+ // Nothing to do here. This constructor is added to=0D
+ // enable the chain of constructor invocation for=0D
+ // dependent libraries.=0D
+ return RETURN_SUCCESS;=0D
+}=0D
=0D
/**=0D
Performs platform specific initialization required for the CPU to access=
=0D
@@ -42,52 +47,49 @@ PlatformHookSerialPortInitialize (
VOID=0D
)=0D
{=0D
- RETURN_STATUS Status;=0D
- UINT32 DeviceVendor;=0D
- PCI_SERIAL_PARAMETER *SerialParam;=0D
- SERIAL_PORT_INFO SerialPortInfo;=0D
-=0D
- Status =3D ParseSerialInfo (&SerialPortInfo);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
+ RETURN_STATUS Status;=0D
+ UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;=0D
+ UINT8 *GuidHob;=0D
+ UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;=0D
=0D
- if (SerialPortInfo.Type =3D=3D PLD_SERIAL_TYPE_MEMORY_MAPPED) {=0D
- Status =3D PcdSetBoolS (PcdSerialUseMmio, TRUE);=0D
- } else { //IO=0D
- Status =3D PcdSetBoolS (PcdSerialUseMmio, FALSE);=0D
- }=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
- Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo.BaseAddr);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
+ GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);=0D
+ if (GuidHob =3D=3D NULL) {=0D
+ return EFI_NOT_FOUND;=0D
}=0D
=0D
- Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo.RegWidth);=
=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
+ GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA=
(GuidHob);=0D
+ if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE =
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {=
=0D
+ return EFI_NOT_FOUND;=0D
}=0D
=0D
- Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo.Baud);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
+ if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_RE=
VISION) {=0D
+ SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB=
_DATA (GuidHob);=0D
+ if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UN=
IVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {=0D
+ //=0D
+ // Return if can't find the Serial Port Info Hob with enough length=
=0D
+ //=0D
+ return EFI_NOT_FOUND;=0D
+ }=0D
=0D
- Status =3D PcdSet32S (PcdSerialClockRate, SerialPortInfo.InputHertz);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
+ Status =3D PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);=0D
+ if (RETURN_ERROR (Status)) {=0D
+ return Status;=0D
+ }=0D
+ Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterB=
ase);=0D
+ if (RETURN_ERROR (Status)) {=0D
+ return Status;=0D
+ }=0D
+ Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->Registe=
rStride);=0D
+ if (RETURN_ERROR (Status)) {=0D
+ return Status;=0D
+ }=0D
+ Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);=0D
+ if (RETURN_ERROR (Status)) {=0D
+ return Status;=0D
+ }=0D
=0D
- if (SerialPortInfo.UartPciAddr >=3D 0x80000000) {=0D
- DeviceVendor =3D PciRead32 (SerialPortInfo.UartPciAddr & 0x0ffff000);=
=0D
- SerialParam =3D PcdGetPtr(PcdPciSerialParameters);=0D
- SerialParam->VendorId =3D (UINT16)DeviceVendor;=0D
- SerialParam->DeviceId =3D DeviceVendor >> 16;=0D
- SerialParam->ClockRate =3D SerialPortInfo.InputHertz;=0D
- SerialParam->RegisterStride =3D (UINT8)SerialPortInfo.RegWidth;=0D
+ return RETURN_SUCCESS;=0D
}=0D
=0D
- return RETURN_SUCCESS;=0D
+ return EFI_NOT_FOUND;=0D
}=0D
diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf b/U=
efiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
index 3eeb94d8fa..7ac6bfa1b1 100644
--- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
+++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
@@ -1,7 +1,7 @@
## @file=0D
-# Platform Hook Library instance for UART device.=0D
+# Platform Hook Library instance for UART device for Universal Payload.=0D
#=0D
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
#=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
@@ -10,29 +10,31 @@
[Defines]=0D
INF_VERSION =3D 0x00010005=0D
BASE_NAME =3D PlatformHookLib=0D
- FILE_GUID =3D 40A2CBC6-CFB8-447b-A90E-198E88FD345E=
=0D
+ FILE_GUID =3D 807E05AB-9411-429F-97F0-FE425BF6B094=
=0D
MODULE_TYPE =3D BASE=0D
VERSION_STRING =3D 1.0=0D
LIBRARY_CLASS =3D PlatformHookLib=0D
- CONSTRUCTOR =3D PlatformHookSerialPortInitialize=0D
+ CONSTRUCTOR =3D PlatformHookSerialPortConstructor=0D
=0D
[Sources]=0D
PlatformHookLib.c=0D
=0D
[LibraryClasses]=0D
- BlParseLib=0D
PcdLib=0D
- PciLib=0D
+ BaseLib=0D
+ HobLib=0D
+ DxeHobListLib=0D
=0D
[Packages]=0D
MdePkg/MdePkg.dec=0D
MdeModulePkg/MdeModulePkg.dec=0D
UefiPayloadPkg/UefiPayloadPkg.dec=0D
=0D
+[Guids]=0D
+ gUniversalPayloadSerialPortInfoGuid=0D
+=0D
[Pcd]=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters ## PRODUCES=0D
diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPaylo=
adPkg/Library/SblParseLib/SblParseLib.inf
index 9ce2864f9f..665a5a8adc 100644
--- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
@@ -1,7 +1,7 @@
## @file=0D
# Slim Bootloader parse library.=0D
#=0D
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>=
=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
##=0D
@@ -43,4 +43,4 @@
gEfiGraphicsDeviceInfoHobGuid=0D
=0D
[Pcd]=0D
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D
+ gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D
diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor=
mHookLib.c b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor=
mHookLib.c
deleted file mode 100644
index 004fcd8b7c..0000000000
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi=
b.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file=0D
- Platform Hook Library instance for UART device.=0D
-=0D
- Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
- SPDX-License-Identifier: BSD-2-Clause-Patent=0D
-=0D
-**/=0D
-=0D
-#include <Base.h>=0D
-#include <PiDxe.h>=0D
-#include <UniversalPayload/SerialPortInfo.h>=0D
-#include <Library/PlatformHookLib.h>=0D
-#include <Library/PcdLib.h>=0D
-#include <Library/HobLib.h>=0D
-=0D
-=0D
-/** Library Constructor=0D
-=0D
- @retval RETURN_SUCCESS Success.=0D
-**/=0D
-EFI_STATUS=0D
-EFIAPI=0D
-PlatformHookSerialPortConstructor (=0D
- VOID=0D
- )=0D
-{=0D
- // Nothing to do here. This constructor is added to=0D
- // enable the chain of constructor invocation for=0D
- // dependent libraries.=0D
- return RETURN_SUCCESS;=0D
-}=0D
-=0D
-/**=0D
- Performs platform specific initialization required for the CPU to access=
=0D
- the hardware associated with a SerialPortLib instance. This function do=
es=0D
- not initialize the serial port hardware itself. Instead, it initializes=
=0D
- hardware devices that are required for the CPU to access the serial port=
=0D
- hardware. This function may be called more than once.=0D
-=0D
- @retval RETURN_SUCCESS The platform specific initialization succee=
ded.=0D
- @retval RETURN_DEVICE_ERROR The platform specific initialization could =
not be completed.=0D
-=0D
-**/=0D
-RETURN_STATUS=0D
-EFIAPI=0D
-PlatformHookSerialPortInitialize (=0D
- VOID=0D
- )=0D
-{=0D
- RETURN_STATUS Status;=0D
- UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;=0D
- UINT8 *GuidHob;=0D
- UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;=0D
-=0D
- GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid);=0D
- if (GuidHob =3D=3D NULL) {=0D
- return EFI_NOT_FOUND;=0D
- }=0D
-=0D
- GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA=
(GuidHob);=0D
- if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE =
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {=
=0D
- return EFI_NOT_FOUND;=0D
- }=0D
-=0D
- if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_RE=
VISION) {=0D
- SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *) GET_GUID_HOB=
_DATA (GuidHob);=0D
- if (GenericHeader->Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UN=
IVERSAL_PAYLOAD_SERIAL_PORT_INFO, RegisterBase)) {=0D
- //=0D
- // Return if can't find the Serial Port Info Hob with enough length=
=0D
- //=0D
- return EFI_NOT_FOUND;=0D
- }=0D
-=0D
- Status =3D PcdSetBoolS (PcdSerialUseMmio, SerialPortInfo->UseMmio);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
- Status =3D PcdSet64S (PcdSerialRegisterBase, SerialPortInfo->RegisterB=
ase);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
- Status =3D PcdSet32S (PcdSerialRegisterStride, SerialPortInfo->Registe=
rStride);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
- Status =3D PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate);=0D
- if (RETURN_ERROR (Status)) {=0D
- return Status;=0D
- }=0D
-=0D
- return RETURN_SUCCESS;=0D
- }=0D
-=0D
- return EFI_NOT_FOUND;=0D
-}=0D
diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platfor=
mHookLib.inf b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/Platf=
ormHookLib.inf
deleted file mode 100644
index 7ac6bfa1b1..0000000000
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLi=
b.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-## @file=0D
-# Platform Hook Library instance for UART device for Universal Payload.=0D
-#=0D
-# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
-#=0D
-# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
-#=0D
-##=0D
-=0D
-[Defines]=0D
- INF_VERSION =3D 0x00010005=0D
- BASE_NAME =3D PlatformHookLib=0D
- FILE_GUID =3D 807E05AB-9411-429F-97F0-FE425BF6B094=
=0D
- MODULE_TYPE =3D BASE=0D
- VERSION_STRING =3D 1.0=0D
- LIBRARY_CLASS =3D PlatformHookLib=0D
- CONSTRUCTOR =3D PlatformHookSerialPortConstructor=0D
-=0D
-[Sources]=0D
- PlatformHookLib.c=0D
-=0D
-[LibraryClasses]=0D
- PcdLib=0D
- BaseLib=0D
- HobLib=0D
- DxeHobListLib=0D
-=0D
-[Packages]=0D
- MdePkg/MdePkg.dec=0D
- MdeModulePkg/MdeModulePkg.dec=0D
- UefiPayloadPkg/UefiPayloadPkg.dec=0D
-=0D
-[Guids]=0D
- gUniversalPayloadSerialPortInfoGuid=0D
-=0D
-[Pcd]=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## PRODUCES=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES=0D
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm b/UefiPaylo=
adPkg/UefiPayloadEntry/Ia32/SecEntry.nasm
deleted file mode 100644
index fa5ed159c6..0000000000
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/SecEntry.nasm
+++ /dev/null
@@ -1,46 +0,0 @@
-;-------------------------------------------------------------------------=
-----=0D
-;*=0D
-;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR=
=0D
-;* SPDX-License-Identifier: BSD-2-Clause-Patent=0D
-=0D
-;-------------------------------------------------------------------------=
-----=0D
-=0D
-#include <Base.h>=0D
-=0D
-SECTION .text=0D
-=0D
-extern ASM_PFX(PayloadEntry)=0D
-extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))=0D
-=0D
-;=0D
-; SecCore Entry Point=0D
-;=0D
-; Processor is in flat protected mode=0D
-=0D
-global ASM_PFX(_ModuleEntryPoint)=0D
-ASM_PFX(_ModuleEntryPoint):=0D
-=0D
- ;=0D
- ; Disable all the interrupts=0D
- ;=0D
- cli=0D
-=0D
- ;=0D
- ; Save the bootloader parameter base address=0D
- ;=0D
- mov eax, [esp + 4]=0D
-=0D
- mov esp, FixedPcdGet32 (PcdPayloadStackTop)=0D
-=0D
- ;=0D
- ; Push the bootloader parameter address onto new stack=0D
- ;=0D
- push 0=0D
- push eax=0D
-=0D
- ;=0D
- ; Call into C code=0D
- ;=0D
- call ASM_PFX(PayloadEntry)=0D
- jmp $=0D
-=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo=
adPkg/UefiPayloadEntry/UefiPayloadEntry.c
index a12d9961f1..f2ac3d2c69 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -385,7 +385,7 @@ BuildGenericHob (
**/=0D
EFI_STATUS=0D
EFIAPI=0D
-PayloadEntry (=0D
+_ModuleEntryPoint (=0D
IN UINTN BootloaderParameter=0D
)=0D
{=0D
@@ -395,13 +395,10 @@ PayloadEntry (
UINTN HobMemBase;=0D
UINTN HobMemTop;=0D
EFI_PEI_HOB_POINTERS Hob;=0D
+ SERIAL_PORT_INFO SerialPortInfo;=0D
+ UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *UniversalSerialPort;=0D
=0D
- // Call constructor for all libraries=0D
- ProcessLibraryConstructorList ();=0D
-=0D
- DEBUG ((DEBUG_INFO, "GET_BOOTLOADER_PARAMETER() =3D 0x%lx\n", GET_BOOTLO=
ADER_PARAMETER()));=0D
- DEBUG ((DEBUG_INFO, "sizeof(UINTN) =3D 0x%x\n", sizeof(UINTN)));=0D
-=0D
+ PcdSet64S (PcdBootloaderParameter, BootloaderParameter);=0D
// Initialize floating point operating environment to be compliant with =
UEFI spec.=0D
InitializeFloatingPointUnits ();=0D
=0D
@@ -412,6 +409,25 @@ PayloadEntry (
=0D
HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, =
(VOID *)HobMemTop);=0D
=0D
+ //=0D
+ // Build serial port info=0D
+ //=0D
+ Status =3D ParseSerialInfo (&SerialPortInfo);=0D
+ if (!EFI_ERROR (Status)) {=0D
+ UniversalSerialPort =3D BuildGuidHob (&gUniversalPayloadSerialPortInfo=
Guid, sizeof (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO));=0D
+ ASSERT (UniversalSerialPort !=3D NULL);=0D
+ UniversalSerialPort->Header.Revision =3D UNIVERSAL_PAYLOAD_SERIAL_PORT=
_INFO_REVISION;=0D
+ UniversalSerialPort->Header.Length =3D sizeof (UNIVERSAL_PAYLOAD_SER=
IAL_PORT_INFO);=0D
+ UniversalSerialPort->UseMmio =3D (SerialPortInfo.Type =3D=3D 1=
)?FALSE:TRUE;=0D
+ UniversalSerialPort->RegisterBase =3D SerialPortInfo.BaseAddr;=0D
+ UniversalSerialPort->BaudRate =3D SerialPortInfo.Baud;=0D
+ UniversalSerialPort->RegisterStride =3D (UINT8)SerialPortInfo.RegWidt=
h;=0D
+ }=0D
+=0D
+ // The library constructors might depend on serial port, so call it afte=
r serial port hob=0D
+ ProcessLibraryConstructorList ();=0D
+ DEBUG ((DEBUG_INFO, "sizeof(UINTN) =3D 0x%x\n", sizeof(UINTN)));=0D
+=0D
// Build HOB based on information from Bootloader=0D
Status =3D BuildHobFromBl ();=0D
if (EFI_ERROR (Status)) {=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo=
adPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 9922b56b39..de51c2fba9 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -35,6 +35,7 @@
#include <UniversalPayload/AcpiTable.h>=0D
#include <UniversalPayload/UniversalPayload.h>=0D
#include <UniversalPayload/ExtraData.h>=0D
+#include <UniversalPayload/SerialPortInfo.h>=0D
#include <Guid/PcdDataBaseSignatureGuid.h>=0D
=0D
#define LEGACY_8259_MASK_REGISTER_MASTER 0x21=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay=
loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 4c5170d9cc..96e4bb81f4 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -32,13 +32,11 @@
X64/VirtualMemory.c=0D
Ia32/DxeLoadFunc.c=0D
Ia32/IdtVectorAsm.nasm=0D
- Ia32/SecEntry.nasm=0D
=0D
[Sources.X64]=0D
X64/VirtualMemory.h=0D
X64/VirtualMemory.c=0D
X64/DxeLoadFunc.c=0D
- X64/SecEntry.nasm=0D
=0D
[Packages]=0D
MdePkg/MdePkg.dec=0D
@@ -67,6 +65,7 @@
gUefiAcpiBoardInfoGuid=0D
gUniversalPayloadSmbiosTableGuid=0D
gUniversalPayloadAcpiTableGuid=0D
+ gUniversalPayloadSerialPortInfoGuid=0D
=0D
[FeaturePcd.IA32]=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUME=
S=0D
@@ -87,7 +86,7 @@
=0D
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase=0D
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize=0D
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D
+ gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize=0D
=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM=
ES_CONSUMES=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue=
fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index e7e05b744a..928bd2e42b 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -92,7 +92,6 @@
=0D
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase=0D
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize=0D
- gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop=0D
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize=0D
=0D
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM=
ES_CONSUMES=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm b/UefiPayloa=
dPkg/UefiPayloadEntry/X64/SecEntry.nasm
deleted file mode 100644
index 974cf77771..0000000000
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/SecEntry.nasm
+++ /dev/null
@@ -1,47 +0,0 @@
-;-------------------------------------------------------------------------=
-----=0D
-;*=0D
-;* Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR=
=0D
-;* SPDX-License-Identifier: BSD-2-Clause-Patent=0D
-=0D
-;-------------------------------------------------------------------------=
-----=0D
-=0D
-#include <Base.h>=0D
-=0D
-DEFAULT REL=0D
-SECTION .text=0D
-=0D
-extern ASM_PFX(PayloadEntry)=0D
-extern ASM_PFX(PcdGet32 (PcdPayloadStackTop))=0D
-=0D
-;=0D
-; SecCore Entry Point=0D
-;=0D
-; Processor is in flat protected mode=0D
-=0D
-global ASM_PFX(_ModuleEntryPoint)=0D
-ASM_PFX(_ModuleEntryPoint):=0D
-=0D
- ;=0D
- ; Disable all the interrupts=0D
- ;=0D
- cli=0D
-=0D
-=0D
- mov rsp, FixedPcdGet32 (PcdPayloadStackTop)=0D
-=0D
- ;=0D
- ; Push the bootloader parameter address onto new stack=0D
- ;=0D
- push rcx=0D
- mov rax, 0=0D
- push rax ; shadow space=0D
- push rax=0D
- push rax=0D
- push rax=0D
-=0D
- ;=0D
- ; Call into C code=0D
- ;=0D
- call ASM_PFX(PayloadEntry)=0D
- jmp $=0D
-=0D
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload=
Pkg.dec
index 8f0a7e3f95..e5e8db8863 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -60,8 +60,8 @@
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase|0|UINT32|0x10000001=0D
## Provides the size of the payload binary in memory=0D
gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize|0|UINT32|0x10000002=0D
-## Payload stack top=0D
-gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop|0x90000|UINT32|0x10000004=
=0D
+## Save bootloader parameter=0D
+gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0|UINT64|0x10000004=0D
=0D
## FFS filename to find the shell application.=0D
gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E,=
0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }|VOID*|0=
x10000005=0D
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload=
Pkg.dsc
index fb805dc772..57b04f10be 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -169,12 +169,7 @@
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf=0D
-=0D
-!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE=0D
HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf=0D
-!else=0D
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D
-!endif=0D
=0D
#=0D
# UEFI & PI=0D
@@ -217,11 +212,7 @@
TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf=0D
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf=
=0D
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort=
Lib16550.inf=0D
-!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE=0D
- PlatformHookLib|UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/P=
latformHookLib.inf=0D
-!else=0D
PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.i=
nf=0D
-!endif=0D
PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/Pla=
tformBootManagerLib.inf=0D
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf=0D
=0D
@@ -366,6 +357,7 @@
=0D
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|$(MAX_LOGICAL_=
PROCESSORS)=0D
gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs|0=0D
+ gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0=0D
=0D
##########################################################################=
######=0D
#=0D
--=20
2.32.0.windows.2

4781 - 4800 of 85991