From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web08.2694.1632849550063548115 for ; Tue, 28 Sep 2021 10:19:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: guo.dong@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="204250177" X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="204250177" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 10:19:09 -0700 X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="478781170" Received: from gdong1-mobl1.amr.corp.intel.com ([10.212.91.91]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 10:19:08 -0700 From: "Guo Dong" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [`edk2-devel][PATCH V2] UefiPayloadPkg: Build a HOB from bootloader ACPI table Date: Tue, 28 Sep 2021 10:18:57 -0700 Message-Id: <20210928171857.1552-1-guo.dong@intel.com> X-Mailer: git-send-email 2.32.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Guo Dong 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 Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Guo Dong --- 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/U= efiPayloadEntry/AcpiTable.c new file mode 100644 index 0000000000..e5f2a2b124 --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c @@ -0,0 +1,202 @@ +/** @file=0D +=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "UefiPayloadEntry.h"=0D +=0D +=0D +/**=0D + Find the board related info from ACPI table=0D +=0D + @param AcpiTableBase ACPI table start address in memory=0D + @param AcpiBoardInfo Pointer to the acpi board info strucutre= =0D +=0D + @retval RETURN_SUCCESS Successfully find out all the required inform= ation.=0D + @retval RETURN_NOT_FOUND Failed to find the required info.=0D +=0D +**/=0D +RETURN_STATUS=0D +ParseAcpiInfo (=0D + IN UINT64 AcpiTableBase,=0D + OUT ACPI_BOARD_INFO *AcpiBoardInfo=0D + )=0D +{=0D + EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;=0D + EFI_ACPI_DESCRIPTION_HEADER *Rsdt;=0D + UINT32 *Entry32;=0D + UINTN Entry32Num;=0D + EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;=0D + EFI_ACPI_DESCRIPTION_HEADER *Xsdt;=0D + UINT64 *Entry64;=0D + UINTN Entry64Num;=0D + UINTN Idx;=0D + UINT32 *Signature;=0D + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr= ;=0D + EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCAT= ION_STRUCTURE *MmCfgBase;=0D +=0D + Rsdp =3D (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTabl= eBase;=0D + DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));=0D + DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, = Rsdp->XsdtAddress));=0D +=0D + //=0D + // Search Rsdt First=0D + //=0D + Fadt =3D NULL;=0D + MmCfgHdr =3D NULL;=0D + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);= =0D + if (Rsdt !=3D NULL) {=0D + Entry32 =3D (UINT32 *)(Rsdt + 1);=0D + Entry32Num =3D (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 2;=0D + for (Idx =3D 0; Idx < Entry32Num; Idx++) {=0D + Signature =3D (UINT32 *)(UINTN)Entry32[Idx];=0D + if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) {=0D + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;=0D + DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));=0D + }=0D +=0D + if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {=0D + MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature;=0D + DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));=0D + }=0D +=0D + if ((Fadt !=3D NULL) && (MmCfgHdr !=3D NULL)) {=0D + goto Done;=0D + }=0D + }=0D + }=0D +=0D + //=0D + // Search Xsdt Second=0D + //=0D + Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);= =0D + if (Xsdt !=3D NULL) {=0D + Entry64 =3D (UINT64 *)(Xsdt + 1);=0D + Entry64Num =3D (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 3;=0D + for (Idx =3D 0; Idx < Entry64Num; Idx++) {=0D + Signature =3D (UINT32 *)(UINTN)Entry64[Idx];=0D + if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) {=0D + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;=0D + DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));=0D + }=0D +=0D + if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {=0D + MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature;=0D + DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));=0D + }=0D +=0D + if ((Fadt !=3D NULL) && (MmCfgHdr !=3D NULL)) {=0D + goto Done;=0D + }=0D + }=0D + }=0D +=0D + if (Fadt =3D=3D NULL) {=0D + return RETURN_NOT_FOUND;=0D + }=0D +=0D +Done:=0D +=0D + AcpiBoardInfo->PmCtrlRegBase =3D Fadt->Pm1aCntBlk;=0D + AcpiBoardInfo->PmTimerRegBase =3D Fadt->PmTmrBlk;=0D + AcpiBoardInfo->ResetRegAddress =3D Fadt->ResetReg.Address;=0D + AcpiBoardInfo->ResetValue =3D Fadt->ResetValue;=0D + AcpiBoardInfo->PmEvtBase =3D Fadt->Pm1aEvtBlk;=0D + AcpiBoardInfo->PmGpeEnBase =3D Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;= =0D +=0D + if (MmCfgHdr !=3D NULL) {=0D + MmCfgBase =3D (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BAS= E_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*) MmCfgHdr + sizeof (*MmCfgHdr));= =0D + AcpiBoardInfo->PcieBaseAddress =3D MmCfgBase->BaseAddress;=0D + AcpiBoardInfo->PcieBaseSize =3D (MmCfgBase->EndBusNumber + 1 - MmCfgBa= se->StartBusNumber) * 4096 * 32 * 8;=0D + } else {=0D + AcpiBoardInfo->PcieBaseAddress =3D 0;=0D + AcpiBoardInfo->PcieBaseSize =3D 0;=0D + }=0D + DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase= ));=0D + DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBas= e));=0D + DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddre= ss));=0D + DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));= =0D + DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));= =0D + DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase))= ;=0D + DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddre= ss));=0D + DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize)= );=0D +=0D + //=0D + // Verify values for proper operation=0D + //=0D + ASSERT(Fadt->Pm1aCntBlk !=3D 0);=0D + ASSERT(Fadt->PmTmrBlk !=3D 0);=0D + ASSERT(Fadt->ResetReg.Address !=3D 0);=0D + ASSERT(Fadt->Pm1aEvtBlk !=3D 0);=0D + ASSERT(Fadt->Gpe0Blk !=3D 0);=0D +=0D + DEBUG_CODE_BEGIN ();=0D + BOOLEAN SciEnabled;=0D +=0D + //=0D + // Check the consistency of SCI enabling=0D + //=0D +=0D + //=0D + // Get SCI_EN value=0D + //=0D + if (Fadt->Pm1CntLen =3D=3D 4) {=0D + SciEnabled =3D (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;=0D + } else {=0D + //=0D + // if (Pm1CntLen =3D=3D 2), use 16 bit IO read;=0D + // if (Pm1CntLen !=3D 2 && Pm1CntLen !=3D 4), use 16 bit IO read as = a fallback=0D + //=0D + SciEnabled =3D (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;=0D + }=0D +=0D + if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&=0D + (Fadt->SmiCmd =3D=3D 0) &&=0D + !SciEnabled) {=0D + //=0D + // The ACPI enabling status is inconsistent: SCI is not enabled but = ACPI=0D + // table does not provide a means to enable it through FADT->SmiCmd= =0D + //=0D + DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsisten= t: SCI is not"=0D + " enabled but the ACPI table does not provide a means to enable it= through FADT->SmiCmd."=0D + " This may cause issues in OS.\n"));=0D + }=0D + DEBUG_CODE_END ();=0D +=0D + return RETURN_SUCCESS;=0D +}=0D +=0D +=0D +/**=0D + Build ACPI board info HOB using infomation from ACPI table=0D +=0D + @param AcpiTableBase ACPI table start address in memory=0D +=0D + @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB = failure.=0D +**/=0D +ACPI_BOARD_INFO *=0D +BuildHobFromAcpi (=0D + IN UINT64 AcpiTableBase=0D + )=0D +{=0D + EFI_STATUS Status;=0D + ACPI_BOARD_INFO AcpiBoardInfo;=0D + ACPI_BOARD_INFO *NewAcpiBoardInfo;=0D +=0D + NewAcpiBoardInfo =3D NULL;=0D + Status =3D ParseAcpiInfo (AcpiTableBase, &AcpiBoardInfo);=0D + ASSERT_EFI_ERROR (Status);=0D + if (!EFI_ERROR (Status)) {=0D + NewAcpiBoardInfo =3D BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (AC= PI_BOARD_INFO));=0D + ASSERT (NewAcpiBoardInfo !=3D NULL);=0D + CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));= =0D + DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));=0D + }=0D + return NewAcpiBoardInfo;=0D +}=0D +=0D +=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index ae16f25c7c..a12d9961f1 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -212,167 +212,6 @@ MemInfoCallback ( =0D =0D =0D -/**=0D - Find the board related info from ACPI table=0D -=0D - @param AcpiTableBase ACPI table start address in memory=0D - @param AcpiBoardInfo Pointer to the acpi board info strucutre= =0D -=0D - @retval RETURN_SUCCESS Successfully find out all the required inform= ation.=0D - @retval RETURN_NOT_FOUND Failed to find the required info.=0D -=0D -**/=0D -RETURN_STATUS=0D -ParseAcpiInfo (=0D - IN UINT64 AcpiTableBase,=0D - OUT ACPI_BOARD_INFO *AcpiBoardInfo=0D - )=0D -{=0D - EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;=0D - EFI_ACPI_DESCRIPTION_HEADER *Rsdt;=0D - UINT32 *Entry32;=0D - UINTN Entry32Num;=0D - EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;=0D - EFI_ACPI_DESCRIPTION_HEADER *Xsdt;=0D - UINT64 *Entry64;=0D - UINTN Entry64Num;=0D - UINTN Idx;=0D - UINT32 *Signature;=0D - EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr= ;=0D - EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCAT= ION_STRUCTURE *MmCfgBase;=0D -=0D - Rsdp =3D (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTabl= eBase;=0D - DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));=0D - DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, = Rsdp->XsdtAddress));=0D -=0D - //=0D - // Search Rsdt First=0D - //=0D - Fadt =3D NULL;=0D - MmCfgHdr =3D NULL;=0D - Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);= =0D - if (Rsdt !=3D NULL) {=0D - Entry32 =3D (UINT32 *)(Rsdt + 1);=0D - Entry32Num =3D (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 2;=0D - for (Idx =3D 0; Idx < Entry32Num; Idx++) {=0D - Signature =3D (UINT32 *)(UINTN)Entry32[Idx];=0D - if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) {=0D - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;=0D - DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));=0D - }=0D -=0D - if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {=0D - MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature;=0D - DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));=0D - }=0D -=0D - if ((Fadt !=3D NULL) && (MmCfgHdr !=3D NULL)) {=0D - goto Done;=0D - }=0D - }=0D - }=0D -=0D - //=0D - // Search Xsdt Second=0D - //=0D - Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);= =0D - if (Xsdt !=3D NULL) {=0D - Entry64 =3D (UINT64 *)(Xsdt + 1);=0D - Entry64Num =3D (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >>= 3;=0D - for (Idx =3D 0; Idx < Entry64Num; Idx++) {=0D - Signature =3D (UINT32 *)(UINTN)Entry64[Idx];=0D - if (*Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGN= ATURE) {=0D - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;=0D - DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));=0D - }=0D -=0D - if (*Signature =3D=3D EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGU= RATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {=0D - MmCfgHdr =3D (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TA= BLE_HEADER *)Signature;=0D - DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));=0D - }=0D -=0D - if ((Fadt !=3D NULL) && (MmCfgHdr !=3D NULL)) {=0D - goto Done;=0D - }=0D - }=0D - }=0D -=0D - if (Fadt =3D=3D NULL) {=0D - return RETURN_NOT_FOUND;=0D - }=0D -=0D -Done:=0D -=0D - AcpiBoardInfo->PmCtrlRegBase =3D Fadt->Pm1aCntBlk;=0D - AcpiBoardInfo->PmTimerRegBase =3D Fadt->PmTmrBlk;=0D - AcpiBoardInfo->ResetRegAddress =3D Fadt->ResetReg.Address;=0D - AcpiBoardInfo->ResetValue =3D Fadt->ResetValue;=0D - AcpiBoardInfo->PmEvtBase =3D Fadt->Pm1aEvtBlk;=0D - AcpiBoardInfo->PmGpeEnBase =3D Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;= =0D -=0D - if (MmCfgHdr !=3D NULL) {=0D - MmCfgBase =3D (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BAS= E_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*) MmCfgHdr + sizeof (*MmCfgHdr));= =0D - AcpiBoardInfo->PcieBaseAddress =3D MmCfgBase->BaseAddress;=0D - AcpiBoardInfo->PcieBaseSize =3D (MmCfgBase->EndBusNumber + 1 - MmCfgBa= se->StartBusNumber) * 4096 * 32 * 8;=0D - } else {=0D - AcpiBoardInfo->PcieBaseAddress =3D 0;=0D - AcpiBoardInfo->PcieBaseSize =3D 0;=0D - }=0D - DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase= ));=0D - DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBas= e));=0D - DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddre= ss));=0D - DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));= =0D - DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));= =0D - DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase))= ;=0D - DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddre= ss));=0D - DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize)= );=0D -=0D - //=0D - // Verify values for proper operation=0D - //=0D - ASSERT(Fadt->Pm1aCntBlk !=3D 0);=0D - ASSERT(Fadt->PmTmrBlk !=3D 0);=0D - ASSERT(Fadt->ResetReg.Address !=3D 0);=0D - ASSERT(Fadt->Pm1aEvtBlk !=3D 0);=0D - ASSERT(Fadt->Gpe0Blk !=3D 0);=0D -=0D - DEBUG_CODE_BEGIN ();=0D - BOOLEAN SciEnabled;=0D -=0D - //=0D - // Check the consistency of SCI enabling=0D - //=0D -=0D - //=0D - // Get SCI_EN value=0D - //=0D - if (Fadt->Pm1CntLen =3D=3D 4) {=0D - SciEnabled =3D (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;=0D - } else {=0D - //=0D - // if (Pm1CntLen =3D=3D 2), use 16 bit IO read;=0D - // if (Pm1CntLen !=3D 2 && Pm1CntLen !=3D 4), use 16 bit IO read as = a fallback=0D - //=0D - SciEnabled =3D (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;=0D - }=0D -=0D - if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&=0D - (Fadt->SmiCmd =3D=3D 0) &&=0D - !SciEnabled) {=0D - //=0D - // The ACPI enabling status is inconsistent: SCI is not enabled but = ACPI=0D - // table does not provide a means to enable it through FADT->SmiCmd= =0D - //=0D - DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsisten= t: SCI is not"=0D - " enabled but the ACPI table does not provide a means to enable it= through FADT->SmiCmd."=0D - " This may cause issues in OS.\n"));=0D - }=0D - DEBUG_CODE_END ();=0D -=0D - return RETURN_SUCCESS;=0D -}=0D -=0D -=0D /**=0D It will build HOBs based on information from bootloaders.=0D =0D @@ -387,8 +226,7 @@ BuildHobFromBl ( EFI_STATUS Status;=0D SYSTEM_TABLE_INFO SysTableInfo;=0D SYSTEM_TABLE_INFO *NewSysTableInfo;=0D - ACPI_BOARD_INFO AcpiBoardInfo;=0D - ACPI_BOARD_INFO *NewAcpiBoardInfo;=0D + ACPI_BOARD_INFO *AcpiBoardInfo;=0D EFI_PEI_GRAPHICS_INFO_HOB GfxInfo;=0D EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo;=0D EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo;=0D @@ -471,20 +309,14 @@ BuildHobFromBl ( //=0D // Create guid hob for acpi board information=0D //=0D - Status =3D ParseAcpiInfo (SysTableInfo.AcpiTableBase, &AcpiBoardInfo);=0D - ASSERT_EFI_ERROR (Status);=0D - if (!EFI_ERROR (Status)) {=0D - NewAcpiBoardInfo =3D BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (AC= PI_BOARD_INFO));=0D - ASSERT (NewAcpiBoardInfo !=3D NULL);=0D - CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));= =0D - DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));=0D - }=0D + AcpiBoardInfo =3D BuildHobFromAcpi (SysTableInfo.AcpiTableBase);=0D + ASSERT (AcpiBoardInfo !=3D NULL);=0D =0D //=0D // Parse memory info and build memory HOBs for reserved DRAM and MMIO=0D //=0D DEBUG ((DEBUG_INFO , "Building ResourceDescriptorHobs for reserved memor= y:\n"));=0D - Status =3D ParseMemoryInfo (MemInfoCallbackMmio, &AcpiBoardInfo);=0D + Status =3D ParseMemoryInfo (MemInfoCallbackMmio, AcpiBoardInfo);=0D if (EFI_ERROR(Status)) {=0D return Status;=0D }=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/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,=0D OUT EFI_FFS_FILE_HEADER **FileHeader=0D );=0D +=0D +/**=0D + Build ACPI board info HOB using infomation from ACPI table=0D +=0D + @param AcpiTableBase ACPI table start address in memory=0D +=0D + @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB = failure.=0D +**/=0D +ACPI_BOARD_INFO *=0D +BuildHobFromAcpi (=0D + IN UINT64 AcpiTableBase=0D + );=0D +=0D #endif=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay= loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index 8d42925fcd..4c5170d9cc 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -25,6 +25,7 @@ UefiPayloadEntry.c=0D LoadDxeCore.c=0D MemoryAllocation.c=0D + AcpiTable.c=0D =0D [Sources.Ia32]=0D X64/VirtualMemory.h=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/Uefi= PayloadPkg/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;=0D UINT8 *GuidHob;=0D EFI_HOB_FIRMWARE_VOLUME *FvHob;=0D + UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTable;=0D + ACPI_BOARD_INFO *AcpiBoardInfo;=0D =0D Hob.Raw =3D (UINT8 *) BootloaderParameter;=0D MinimalNeededSize =3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);=0D @@ -351,6 +353,16 @@ BuildHobs ( *DxeFv =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) ExtraData->Entry[0].Ba= se;=0D ASSERT ((*DxeFv)->FvLength =3D=3D ExtraData->Entry[0].Size);=0D =0D + //=0D + // Create guid hob for acpi board information=0D + //=0D + GuidHob =3D GetFirstGuidHob(&gUniversalPayloadAcpiTableGuid);=0D + if (GuidHob !=3D NULL) {=0D + AcpiTable =3D (UNIVERSAL_PAYLOAD_ACPI_TABLE *) GET_GUID_HOB_DATA (Guid= Hob);=0D + AcpiBoardInfo =3D BuildHobFromAcpi ((UINT64)AcpiTable->Rsdp);=0D + ASSERT (AcpiBoardInfo !=3D NULL);=0D + }=0D +=0D //=0D // Update DXE FV information to first fv hob in the hob list, which=0D // is the empty FvHob created before.=0D diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/Ue= fiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index 3ee449219d..e7e05b744a 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -25,6 +25,7 @@ LoadDxeCore.c=0D MemoryAllocation.c=0D PrintHob.c=0D + AcpiTable.c=0D =0D [Sources.Ia32]=0D X64/VirtualMemory.h=0D @@ -61,7 +62,6 @@ gEfiGraphicsDeviceInfoHobGuid=0D gUefiAcpiBoardInfoGuid=0D gEfiSmbiosTableGuid=0D - gEfiAcpiTableGuid=0D gUefiSerialPortInfoGuid=0D gUniversalPayloadExtraDataGuid=0D gPcdDataBaseHobGuid=0D --=20 2.32.0.windows.2