From mboxrd@z Thu Jan 1 00:00:00 1970 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:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=aUF2LAG5; spf=pass (domain: intel.com, ip: 134.134.136.65, 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=1648080732; x=1679616732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G7ZDKjL14gWbyYR5YGgxHQyJyFgXXN/fQ/JrR2SOMQA=; b=aUF2LAG5X4Ew5QlEkNy1ttIw78WOhjfeuNyHRXBR30FVEkAPYUirqkE9 UWN2VpSDnMc38t0rb5ImYmz8wNR3x8ok0Tmx+zcMjrHbVoTLMgIzLZfni hZm4hHhSrq3BCwzyf1v/khluoOkQZd9OasErdItss/z9MeMZYN9A7EmWO OwXf4plWCwdqKVmIMKxdkBUdY8qu7CiwCJkAZoa18bBtnjYSg3JIAQ9Nl ef0WgHGmbWu+I3OQN2Xs6xgH0eqmJQYbiDLuMOMeLXRGHqUi9UjSXaapz DnoLnFoVmLvIVw7XGRNMq/qkjtHRBjS8OhkUOhmq2UMcq5xBGjOLXaEHS w==; X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="258207586" X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="258207586" 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:11 -0700 X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="649651376" 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:09 -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 V10 28/47] OvmfPkg/PlatformPei: Refactor MiscInitialization Date: Thu, 24 Mar 2022 08:10:14 +0800 Message-Id: <20220324001033.1169-29-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20220324001033.1169-1-min.m.xu@intel.com> References: <20220324001033.1169-1-min.m.xu@intel.com> 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