From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.903.1647050145463002246 for ; Fri, 11 Mar 2022 17:55:51 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=HZheGkZk; spf=pass (domain: intel.com, ip: 192.55.52.115, 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=1647050150; x=1678586150; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+h2UIAzxIaYD+AzfNMLxtLgEvdFw/XaJgc3uBYpdt0I=; b=HZheGkZklkHxc7yFVF2xYDAd9ehvoFtx8/iA/BLPgGu8S3g5cXFGOTDX Vb+WEWDpscB5s31MpdHjxyxqMTeW3lm1H2dMzNe0FJYl86XPn6s2mmYnq i0vMDDSekhVaPi5SojpBy4OF7ijczBxYLCZjAyRq9y1yLtj90myZbJYO0 42yiLkU4AtsEDvqoM8aBqlZ1qGjaMClhWsC6n8I1byw0U4f+u9+u1MdHZ CJ6hZnvMc2E1/WQKoS+m95luyP9ZxxeQMKSkzlo1GpvdxwO7kZQ/erdZJ R/t+UVKWV7vqKbPLyrTmGye0to18cxMtAs13TvghcdhTR3KqS37QQQlQ6 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="255894743" X-IronPort-AV: E=Sophos;i="5.90,175,1643702400"; d="scan'208";a="255894743" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 17:55:50 -0800 X-IronPort-AV: E=Sophos;i="5.90,175,1643702400"; d="scan'208";a="555564889" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.254]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 17:55:47 -0800 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 V8 27/47] OvmfPkg/PlatformPei: Refactor MiscInitialization Date: Sat, 12 Mar 2022 09:53:52 +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 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 2d652b0dc127..a5ed2c0bcc99 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