OvmfPkg: Use newly defined Unaccepted Memory Type

EFI_RESOURCE_MEMORY_UNACCEPTED has been officially defined in the PI
1.8 specification. So all temporary solutions have been replaced with
the actual definition.

Cc: Felix Polyudov <felixp@ami.com>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
This commit is contained in:
Sachin Ganesh 2024-04-17 17:59:33 +05:30 committed by mergify[bot]
parent f3b0ee0cee
commit b82c9631da
5 changed files with 14 additions and 14 deletions

View File

@ -20,7 +20,7 @@
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Guid/ConfidentialComputingSevSnpBlob.h> #include <Guid/ConfidentialComputingSevSnpBlob.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Pi/PrePiDxeCis.h> #include <Pi/PiDxeCis.h>
#include <Protocol/SevMemoryAcceptance.h> #include <Protocol/SevMemoryAcceptance.h>
#include <Protocol/MemoryAccept.h> #include <Protocol/MemoryAccept.h>
#include <Uefi/UefiSpec.h> #include <Uefi/UefiSpec.h>
@ -119,7 +119,7 @@ AcceptAllMemory (
CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc; CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
Desc = &AllDescMap[Index]; Desc = &AllDescMap[Index];
if (Desc->GcdMemoryType != EFI_GCD_MEMORY_TYPE_UNACCEPTED) { if (Desc->GcdMemoryType != EfiGcdMemoryTypeUnaccepted) {
continue; continue;
} }

View File

@ -19,7 +19,7 @@
#include <Library/TdxLib.h> #include <Library/TdxLib.h>
#include <Library/TdxMailboxLib.h> #include <Library/TdxMailboxLib.h>
#include <Library/SynchronizationLib.h> #include <Library/SynchronizationLib.h>
#include <Pi/PrePiHob.h> #include <Pi/PiHob.h>
#include <WorkArea.h> #include <WorkArea.h>
#include <ConfidentialComputingGuestAttr.h> #include <ConfidentialComputingGuestAttr.h>
#include <Library/TdxHelperLib.h> #include <Library/TdxHelperLib.h>
@ -351,7 +351,7 @@ AcceptMemoryForAPsStack (
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
DEBUG ((DEBUG_INFO, "\nResourceType: 0x%x\n", Hob.ResourceDescriptor->ResourceType)); DEBUG ((DEBUG_INFO, "\nResourceType: 0x%x\n", Hob.ResourceDescriptor->ResourceType));
if (Hob.ResourceDescriptor->ResourceType == BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {
ResourceLength = Hob.ResourceDescriptor->ResourceLength; ResourceLength = Hob.ResourceDescriptor->ResourceLength;
PhysicalStart = Hob.ResourceDescriptor->PhysicalStart; PhysicalStart = Hob.ResourceDescriptor->PhysicalStart;
PhysicalEnd = PhysicalStart + ResourceLength; PhysicalEnd = PhysicalStart + ResourceLength;
@ -427,7 +427,7 @@ AcceptMemory (
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {
PhysicalStart = Hob.ResourceDescriptor->PhysicalStart; PhysicalStart = Hob.ResourceDescriptor->PhysicalStart;
PhysicalEnd = PhysicalStart + Hob.ResourceDescriptor->ResourceLength; PhysicalEnd = PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
@ -563,7 +563,7 @@ ValidateHobList (
EFI_RESOURCE_MEMORY_MAPPED_IO_PORT, EFI_RESOURCE_MEMORY_MAPPED_IO_PORT,
EFI_RESOURCE_MEMORY_RESERVED, EFI_RESOURCE_MEMORY_RESERVED,
EFI_RESOURCE_IO_RESERVED, EFI_RESOURCE_IO_RESERVED,
BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED EFI_RESOURCE_MEMORY_UNACCEPTED
}; };
if (VmmHobList == NULL) { if (VmmHobList == NULL) {

View File

@ -20,7 +20,7 @@
#include <IndustryStandard/UefiTcgPlatform.h> #include <IndustryStandard/UefiTcgPlatform.h>
#include <Library/PlatformInitLib.h> #include <Library/PlatformInitLib.h>
#include <OvmfPlatforms.h> #include <OvmfPlatforms.h>
#include <Pi/PrePiHob.h> #include <Pi/PiHob.h>
#include "PeilessStartupInternal.h" #include "PeilessStartupInternal.h"
/** /**
@ -92,7 +92,7 @@ ConstructFwHobList (
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {
PhysicalEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength; PhysicalEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
ResourceLength = Hob.ResourceDescriptor->ResourceLength; ResourceLength = Hob.ResourceDescriptor->ResourceLength;

View File

@ -17,7 +17,7 @@
#include <IndustryStandard/Tdx.h> #include <IndustryStandard/Tdx.h>
#include <IndustryStandard/IntelTdx.h> #include <IndustryStandard/IntelTdx.h>
#include <Library/PeiServicesLib.h> #include <Library/PeiServicesLib.h>
#include <Pi/PrePiHob.h> #include <Pi/PiHob.h>
#include <WorkArea.h> #include <WorkArea.h>
#include <ConfidentialComputingGuestAttr.h> #include <ConfidentialComputingGuestAttr.h>
@ -40,9 +40,9 @@ BuildResourceDescriptorHobForUnacceptedMemory (
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
UINT64 MaxAcceptedMemoryAddress; UINT64 MaxAcceptedMemoryAddress;
ASSERT (Hob->ResourceType == BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED); ASSERT (Hob->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED);
ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED; ResourceType = EFI_RESOURCE_MEMORY_UNACCEPTED;
ResourceAttribute = Hob->ResourceAttribute; ResourceAttribute = Hob->ResourceAttribute;
PhysicalStart = Hob->PhysicalStart; PhysicalStart = Hob->PhysicalStart;
ResourceLength = Hob->ResourceLength; ResourceLength = Hob->ResourceLength;
@ -104,7 +104,7 @@ TransferTdxHobList (
ResourceType = Hob.ResourceDescriptor->ResourceType; ResourceType = Hob.ResourceDescriptor->ResourceType;
ResourceAttribute = Hob.ResourceDescriptor->ResourceAttribute; ResourceAttribute = Hob.ResourceDescriptor->ResourceAttribute;
if (ResourceType == BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED) { if (ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {
BuildResourceDescriptorHobForUnacceptedMemory (Hob.ResourceDescriptor); BuildResourceDescriptorHobForUnacceptedMemory (Hob.ResourceDescriptor);
} else { } else {
BuildResourceDescriptorHob ( BuildResourceDescriptorHob (

View File

@ -17,7 +17,7 @@
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Pi/PrePiHob.h> #include <Pi/PiHob.h>
#include <PiPei.h> #include <PiPei.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include <Register/Intel/SmramSaveStateMap.h> #include <Register/Intel/SmramSaveStateMap.h>
@ -149,7 +149,7 @@ AmdSevSnpInitialize (
if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
if (ResourceHob->PhysicalStart >= SIZE_4GB) { if (ResourceHob->PhysicalStart >= SIZE_4GB) {
ResourceHob->ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED; ResourceHob->ResourceType = EFI_RESOURCE_MEMORY_UNACCEPTED;
continue; continue;
} }