From nobody Thu May 2 17:01:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70881+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70881+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1611885582; cv=none; d=zohomail.com; s=zohoarc; b=A6jESP5YQQ6e19r+iD3UDasZD91i9G9iaIKY2fBuzjqIsVe3N7RML97+Wi2XzHOXknfT3JDKtGoh2YwBMyaO6Vix3rGp03QDX8YxsDVRDCokWbVt3KM+lAeJHBeKOM7zHLZHzpzY6mLe1gXcrmkfRlaM2a6u2PFfA0+kPOSV3wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611885582; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=GrsOehLpGen4K1YoQ0ZsgVbf9bI5ye32XkThety/ITc=; b=U9WDWuMi8M2JrPEaP0cixsFVdIWZIf7OZwABSSlNmTdCv/G4QXCPXFHhu3ZPGvhgnL8tnhKztvX9qyKkRSLoUl94hVz6PcE6NU/b1PQAKW4Q/DnH7O8yc8+zCwCnAFxV9OdvIXcbzxq6wEPGwynG2UJUfDiMShTBHYxlUsM1ufo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70881+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1611885582131895.97350322904; Thu, 28 Jan 2021 17:59:42 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Wbe7YY1788612xhL4vRxeakM; Thu, 28 Jan 2021 17:59:41 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.3886.1611885581084839509 for ; Thu, 28 Jan 2021 17:59:41 -0800 IronPort-SDR: +lN4r8ISv0qNc/Z7nzXv+DFA41TOsbT09bpeneJTecj2a1+IEgCfVY9umm4Yw2DEc51n20CkO/ 8VFqQ2tznfXA== X-IronPort-AV: E=McAfee;i="6000,8403,9878"; a="179565278" X-IronPort-AV: E=Sophos;i="5.79,384,1602572400"; d="scan'208";a="179565278" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2021 17:59:39 -0800 IronPort-SDR: JP5gJ8zS6EvtJ6+jidBcY7yDg8Cl5GI31Jl5HtR5m9KHu/xQnFw2JMDEN9WBz1Wegsczv9Tqhg U9p343bbSRwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,384,1602572400"; d="scan'208";a="430804620" X-Received: from plxs0284.pdx.intel.com ([10.38.240.7]) by orsmga001.jf.intel.com with ESMTP; 28 Jan 2021 17:59:39 -0800 X-Received: from younghyu-desk1.jf.intel.com (younghyu-desk1.jf.intel.com [134.134.154.164]) by plxs0284.pdx.intel.com with ESMTP id 10T1xdLv006836; Thu, 28 Jan 2021 17:59:39 -0800 From: "Park, Aiden" To: guo.dong@intel.com, maurice.ma@intel.com, devel@edk2.groups.io Cc: aiden.park@intel.com Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Update EFI Memory Service conditions Date: Thu, 28 Jan 2021 17:59:37 -0800 Message-Id: <20210129015937.1983-1-aiden.park@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,aiden.park@intel.com X-Gm-Message-State: gjc8R4MHSpUotcxTV9DaTM6rx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1611885581; bh=dsfPcf5aFOwuEt3FUQyjhh2h3guzaONgi9iQy6EscZY=; h=Cc:Date:From:Reply-To:Subject:To; b=j8dFn0BCf0cVxoVFu6O3SW1/cq1EQLAWZskXokiss5BMzrmEPC5UYFJQG58VQdTq8w6 nTELtz/WasRhawWYD8SrMb52nLi2PXKaoFREgY8KqZ6DW8afzobREEDjreRreGgfhx03D k0AFlCUqMm/2IeT3FkDSApyFXmS4ZGeqWiY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Aiden Park The CoreInitializeMemoryServices() looks for a suitable memory region for EFI Memory Service from the ResourceDescriptor Hob. This patch does not allow legacy memory region for the Memory Service and provides default memory type information to calculate minimal required memory size properly for the Memory Service. Signed-off-by: Aiden Park --- .../UefiPayloadEntry/UefiPayloadEntry.c | 20 +++++++++++++++++++ .../UefiPayloadEntry/UefiPayloadEntry.inf | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index 805f5448d9..d2e6f962cd 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -6,6 +6,16 @@ **/ =20 #include "UefiPayloadEntry.h" +#include + +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D { + { EfiACPIReclaimMemory, FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemo= ry) }, + { EfiACPIMemoryNVS, FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) = }, + { EfiReservedMemoryType, FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryT= ype) }, + { EfiRuntimeServicesData, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServices= Data) }, + { EfiRuntimeServicesCode, FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServices= Code) }, + { EfiMaxMemoryType, 0 } +}; =20 /** Callback function to build resource descriptor HOB @@ -44,6 +54,9 @@ MemInfoCallback ( // Remove tested attribute to avoid DXE core to dispatch driver to mem= ory above 4GB Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED; } + if (Base =3D=3D 0x00) { + Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED; + } =20 BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, = Size); DEBUG ((DEBUG_INFO , "buildhob: base =3D 0x%lx, size =3D 0x%lx, type =3D= 0x%x\n", Base, Size, Type)); @@ -315,6 +328,13 @@ BuildGenericHob ( UINT8 PhysicalAddressBits; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; =20 + // + // Create Memory Type Information HOB + // + BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, + mDefaultMemoryTypeInformation, + sizeof (mDefaultMemoryTypeInformation)); + // The UEFI payload FV BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (PcdP= ayloadFdMemSize), EfiBootServicesData); =20 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay= loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index cc59f1903b..5cb084ca51 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -86,6 +86,11 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize gUefiPayloadPkgTokenSpaceGuid.PcdPayloadStackTop gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode =20 gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIM= ES_CONSUMES --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70881): https://edk2.groups.io/g/devel/message/70881 Mute This Topic: https://groups.io/mt/80200968/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-