From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.8480.1648454962517853012 for ; Mon, 28 Mar 2022 01:10:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=mgybK7IU; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648455009; x=1679991009; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G7ZDKjL14gWbyYR5YGgxHQyJyFgXXN/fQ/JrR2SOMQA=; b=mgybK7IUJytQiEl2JGesFjBXGkRLDhxwGjO4XoeFLjtZFbU6sI+lAHu+ 9Whlmy5RY/I9e8rgl+H0uJbw0c/PKvIblhKtQnuuKA5te+i/ztPyNcB8B X4XDMv3Q+5xlO+mNoLtunmnWwSOlYPERn5u+lqSjY9q4erPTJ7T7OxIMI K1TGZi/vC1AL8xDytos7xD5S/bCpGI0y8TLZ8ZOTD8xywoKdAoPWM0P/K E7e77IR+L5Wno0TCmvvS+TNhXzvdoe3/IfEyoJmLCJAuhPQEwNVEhPolB hIbA4vCmGu+m3uZCs8Ljl38Y6UAdTBaoZuwivxsKKiagS4nglM34fVTf3 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="257771177" X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="257771177" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 01:10:09 -0700 X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="563428014" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.175.167]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 01:10:06 -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: [PATCH V11 28/47] OvmfPkg/PlatformPei: Refactor MiscInitialization Date: Mon, 28 Mar 2022 16:08:07 +0800 Message-Id: X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3863 MiscInitialization is split into 2 functions: - PlatformMiscInitialization is for PlatformInitLib. - MiscInitialization calls PlatformMiscInitialization and then sets PCD. 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 | 43 ++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index e91acca9f769..02697c473d01 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -57,12 +57,12 @@ PlatformMemMapInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINT64 PciIoBase; - UINT64 PciIoSize; - UINT32 TopOfLowRam; - UINT64 PciExBarBase; - UINT32 PciBase; - UINT32 PciSize; + UINT64 PciIoBase; + UINT64 PciIoSize; + UINT32 TopOfLowRam; + UINT64 PciExBarBase; + UINT32 PciBase; + UINT32 PciSize; PciIoBase = 0xC000; PciIoSize = 0x4000; @@ -360,17 +360,16 @@ MiscInitializationForMicrovm ( } VOID -MiscInitialization ( +PlatformMiscInitialization ( IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - UINTN PmCmd; - UINTN Pmba; - UINT32 PmbaAndVal; - UINT32 PmbaOrVal; - UINTN AcpiCtlReg; - UINT8 AcpiEnBit; - RETURN_STATUS PcdStatus; + UINTN PmCmd; + UINTN Pmba; + UINT32 PmbaAndVal; + UINT32 PmbaOrVal; + UINTN AcpiCtlReg; + UINT8 AcpiEnBit; // // Disable A20 Mask @@ -417,9 +416,6 @@ MiscInitialization ( return; } - PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, PlatformInfoHob->HostBridgeDevId); - ASSERT_RETURN_ERROR (PcdStatus); - if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) { DEBUG ((DEBUG_INFO, "%a: Cloud Hypervisor is done.\n", __FUNCTION__)); return; @@ -464,6 +460,19 @@ MiscInitialization ( } } +VOID +MiscInitialization ( + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + RETURN_STATUS PcdStatus; + + PlatformMiscInitialization (PlatformInfoHob); + + PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, PlatformInfoHob->HostBridgeDevId); + ASSERT_RETURN_ERROR (PcdStatus); +} + VOID BootModeInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob -- 2.29.2.windows.2