From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.2816.1608843349477950953 for ; Thu, 24 Dec 2020 12:55:50 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: guo.dong@intel.com) IronPort-SDR: 2MuqK5Oq4OW+3HxACSSMKttUp216TxWmbevqxmYBG2/wnf1Sck0EoYVuYLZxmMkptQJDlbBzwx z0XqJcDtSXKQ== X-IronPort-AV: E=McAfee;i="6000,8403,9845"; a="240263294" X-IronPort-AV: E=Sophos;i="5.78,446,1599548400"; d="scan'208";a="240263294" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2020 12:55:43 -0800 IronPort-SDR: xHqMCNDm/tmXrxKxP2C4ak0XskwSA5oc+KMOxDQTS6FCpzHT0y3WKY0BM/HFtD4BOmEJL3qjLX kou0SaC1DGlQ== X-IronPort-AV: E=Sophos;i="5.78,446,1599548400"; d="scan'208";a="417730458" Received: from gdong1-mobl.amr.corp.intel.com ([10.212.176.23]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2020 12:55:41 -0800 From: "Guo Dong" To: devel@edk2.groups.io Cc: eric.dong@intel.com, maurice.ma@intel.com, benjamin.you@intel.com, philipp.deppenwiese@9elements.com Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Add memory type information HOB Date: Thu, 24 Dec 2020 13:55:37 -0700 Message-Id: <20201224205537.20648-1-guo.dong@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 To avoid DXE drivers to be dispatched to memory above 4GB, this patch build memory type information HOB in payload entry module. Signed-off-by: Guo Dong --- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 23 ++++++++++++++++++----- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 1 + UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 5 +++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c index 805f5448d9..5d8b9d1464 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -7,6 +7,16 @@ #include "UefiPayloadEntry.h" + +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = { + { EfiACPIReclaimMemory, FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory) }, + { EfiACPIMemoryNVS, FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) }, + { EfiReservedMemoryType, FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryType) }, + { EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesData) }, + { EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode) }, + { EfiMaxMemoryType, 0 } +}; + /** Callback function to build resource descriptor HOB @@ -40,11 +50,6 @@ MemInfoCallback ( EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE; - if (Base >= BASE_4GB ) { - // Remove tested attribute to avoid DXE core to dispatch driver to memory above 4GB - Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED; - } - BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, Size); DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type)); @@ -343,6 +348,14 @@ BuildGenericHob ( BuildResourceDescriptorHob (EFI_RESOURCE_MEMORY_MAPPED_IO, ResourceAttribute, 0xFEC80000, SIZE_512KB); BuildMemoryAllocationHob ( 0xFEC80000, SIZE_512KB, EfiMemoryMappedIO); + // + // Create Memory Type Information HOB + // + BuildGuidDataHob ( + &gEfiMemoryTypeInformationGuid, + mDefaultMemoryTypeInformation, + sizeof(mDefaultMemoryTypeInformation) + ); } diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h index 2c84d6ed53..57b03dffe9 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -31,6 +31,7 @@ #include #include #include +#include #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index cc59f1903b..444d03b6d4 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -84,6 +84,11 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize -- 2.16.2.windows.1