From nobody Mon Feb 9 08:57:18 2026 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+87962+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+87962+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1648080727; cv=none; d=zohomail.com; s=zohoarc; b=BwZjAlACLs/tTjBjP3D8mmFRdFNEJQUV5MnYqWyW7pDn2seONF5bNskvxC+GZbXZvMyMcpeGeqJLp8IDmuwNKtSa5M+ZJHpjgw9ALpHZHo2L1YJplWe11suXsS0YvWTpBf9zJLNpvP1BX1fClBgAWAbdg/1xmLWlRPX0hmu0Wh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648080727; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=4MQu+t+6ICYDtepzvMw9t7eQwJbnpYb62b3bz7GXdkU=; b=TNDneR9TqscU6xQhqABNCFpCrw/KgKZzSypHvGtmyFd8kfvEwpzcoaz9Oi3IIfAOrFJkyCoru7BRg1uCv622kYttOV34zompRaF5AWE9UTnbx+0fm116U423kRyMgjOBuJKBNYqWd6s+h+B9a4MPhGXLypQgUgX7VS3A9dFKG7I= 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+87962+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648080727198687.5486809729971; Wed, 23 Mar 2022 17:12:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Y9fNYY1788612xQHsYzNm0iT; Wed, 23 Mar 2022 17:12:06 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.4779.1648080680578717265 for ; Wed, 23 Mar 2022 17:12:06 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="258207535" X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="258207535" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="649651316" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.90]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:03 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann , Sebastien Boeuf Subject: [edk2-devel] [PATCH V10 26/47] OvmfPkg/PlatformPei: Refactor MemMapInitialization Date: Thu, 24 Mar 2022 08:10:12 +0800 Message-Id: <20220324001033.1169-27-min.m.xu@intel.com> In-Reply-To: <20220324001033.1169-1-min.m.xu@intel.com> References: <20220324001033.1169-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,min.m.xu@intel.com X-Gm-Message-State: w91ce79bqG2rlAUTHJV96Tg6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648080726; bh=dH5NoXjLWAoCyr0G0zi48sGqDRf9erb00SAyzBp4PLI=; h=Cc:Date:From:Reply-To:Subject:To; b=nrYKYiGBRPpzQL3+ivDZtHC2lzMhHN0nayC1vNXGhbRK8gqTV6M98OW6evmKHlLYDXO yyLRaOK5d0h6oE/kezR4DjZKiqRk7ZvSigRMVuA8dsE+I8LtTBUgIRX6x0tZVNnuHrX61 eT5+JvphawpkjySgGCUb2eBCiD1aEM8axH0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648080728006100017 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3863 MemMapInitialization is split into 2 functions: - PlatformMemMapInitialization is for PlatformInfoLib - MemMapInitialization calls PlatformMemMapInitialization and then sets PCDs. It is for PlatformPei. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Cc: Sebastien Boeuf Acked-by: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/PlatformPei/Platform.c | 35 +++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index f89d14493ecf..b83bd7515809 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -52,7 +52,8 @@ EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D { }; =20 VOID -MemMapInitialization ( +EFIAPI +PlatformMemMapInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { @@ -110,10 +111,6 @@ MemMapInitialization ( // PciSize =3D 0xFC000000 - PciBase; PlatformAddIoMemoryBaseSizeHob (PciBase, PciSize); - PcdStatus =3D PcdSet64S (PcdPciMmio32Base, PciBase); - ASSERT_RETURN_ERROR (PcdStatus); - PcdStatus =3D PcdSet64S (PcdPciMmio32Size, PciSize); - ASSERT_RETURN_ERROR (PcdStatus); =20 PlatformInfoHob->PcdPciMmio32Base =3D PciBase; PlatformInfoHob->PcdPciMmio32Size =3D PciSize; @@ -173,15 +170,35 @@ MemMapInitialization ( PciIoBase, PciIoSize ); - PcdStatus =3D PcdSet64S (PcdPciIoBase, PciIoBase); - ASSERT_RETURN_ERROR (PcdStatus); - PcdStatus =3D PcdSet64S (PcdPciIoSize, PciIoSize); - ASSERT_RETURN_ERROR (PcdStatus); =20 PlatformInfoHob->PcdPciIoBase =3D PciIoBase; PlatformInfoHob->PcdPciIoSize =3D PciIoSize; } =20 +VOID +MemMapInitialization ( + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + RETURN_STATUS PcdStatus; + + PlatformMemMapInitialization (PlatformInfoHob); + + if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) { + return; + } + + PcdStatus =3D PcdSet64S (PcdPciMmio32Base, PlatformInfoHob->PcdPciMmio32= Base); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet64S (PcdPciMmio32Size, PlatformInfoHob->PcdPciMmio32= Size); + ASSERT_RETURN_ERROR (PcdStatus); + + PcdStatus =3D PcdSet64S (PcdPciIoBase, PlatformInfoHob->PcdPciIoBase); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet64S (PcdPciIoSize, PlatformInfoHob->PcdPciIoSize); + ASSERT_RETURN_ERROR (PcdStatus); +} + #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName) \ do { \ BOOLEAN Setting; \ --=20 2.29.2.windows.2 -=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 (#87962): https://edk2.groups.io/g/devel/message/87962 Mute This Topic: https://groups.io/mt/89989249/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-