From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mx.groups.io with SMTP id smtpd.web10.9641.1665766153788045102 for ; Fri, 14 Oct 2022 09:49:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=I5Cu/2cf; spf=pass (domain: ventanamicro.com, ip: 209.85.216.45, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pj1-f45.google.com with SMTP id t10-20020a17090a4e4a00b0020af4bcae10so5229915pjl.3 for ; Fri, 14 Oct 2022 09:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dLaOAHpYqyQ3SaFtedPgg4ib7GY5nk16cIbFE3/ke/k=; b=I5Cu/2cfCBFRCfBbVicAvR8pzTalm7cDhCsjG40E5xTl3kHEGVtnqRTF8a68Hng6QH vFZNzLw1d8syXkYFdQrwlNprxVx5wFjamDo3aRBCKUhmVRtF/PHXDGaZ6/B3qEybN6pc Q3GdaTlnchTcHuSP0VhKPTOIJGo/qMnreWI5K8f0QZ6T2wil5Z993VD+QQa02g8zMSKF vzNLJx4Y70G8hG2K5SrNZIFohyEx83TxAflvf0wLuNq+Cjse7AMxLsTx94W70oQZo3py zoaHa3byAyZFYuInWnufNbPSxgKOFe3dWSajhTUAQ9hmm8Z+S8bTd1PTLYaSFBWz5D03 AR4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dLaOAHpYqyQ3SaFtedPgg4ib7GY5nk16cIbFE3/ke/k=; b=E2QlWYq8hqwqlmPaE2ki3xbdDqQV4JNocX9Qq2v5wDvEThas6LJVxJ34DUmI0LWqfP /0l+RTUhP6ox6pgFcWLQJ9/HdxF0Fb1zEmP8x7JlQGk37gUTVHnpT2K8P9aDVzVQJsP/ GOLGuM+jjwjuS7uuGfYU58AWBbmcIhnIDAgtsvNS4dkfPbv83UkvCMTYcEp6BzlHT1BJ HUwcXlFIK/5KiUnpXvtPaWWaBpWY2CMOqkSWY3xk6iXovhyelTTkR69CertpEJjaskHx QIAZwtHPy/howNSLhvdX6bPRfdHdglwV9gGsSvIil0Y1wq+rR5QevM6PxVGMHGYlOrQo d4FQ== X-Gm-Message-State: ACrzQf1q5ldP4ba/OUDjD/blYmu/2WA+O95XHu4TOr2v4LL+lSx/R+Fj BxVoWcGOSxE7D0a6bfEO+CS9pSz9P5nDRA== X-Google-Smtp-Source: AMsMyM7bjzSrFZ7X5bFgryvUOr/o0/G09yDpnK6M9zw92xS/wVco40oFXGUgCfeJYwsgpz8CL1qc4w== X-Received: by 2002:a17:90b:3c8f:b0:20d:959b:26f4 with SMTP id pv15-20020a17090b3c8f00b0020d959b26f4mr6877565pjb.104.1665766152666; Fri, 14 Oct 2022 09:49:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([49.206.13.138]) by smtp.gmail.com with ESMTPSA id f3-20020a62db03000000b0056265011136sm1963368pfg.112.2022.10.14.09.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 09:49:11 -0700 (PDT) From: "Sunil V L" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann Subject: [edk2-staging/RiscV64QemuVirt PATCH V4 11/34] OvmfPkg/PlatformPei: Refactor to allow other architectures Date: Fri, 14 Oct 2022 22:18:13 +0530 Message-Id: <20221014164836.1513036-12-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221014164836.1513036-1-sunilvl@ventanamicro.com> References: <20221014164836.1513036-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076 Currently, PlatformPei supports only X86 architecture. So, refactor it to allow other CPU architectures. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Sunil V L --- OvmfPkg/PlatformPei/PlatformPei.inf | 34 +++++++++++--------- OvmfPkg/PlatformPei/{ => Ia32X64}/Platform.h | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/AmdSev.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/ClearCache.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/FeatureControl.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/Fv.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/IntelTdx.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/MemDetect.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/MemTypeInfo.c | 0 OvmfPkg/PlatformPei/{ => Ia32X64}/Platform.c | 0 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 3cd83e6ec3e5..c637f621cb1f 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -22,16 +22,16 @@ [Defines] # VALID_ARCHITECTURES = IA32 X64 EBC # -[Sources] - AmdSev.c - ClearCache.c - FeatureControl.c - Fv.c - MemDetect.c - MemTypeInfo.c - Platform.c - Platform.h - IntelTdx.c +[Sources.IA32, Sources.X64] + Ia32X64/AmdSev.c + Ia32X64/ClearCache.c + Ia32X64/FeatureControl.c + Ia32X64/Fv.c + Ia32X64/MemDetect.c + Ia32X64/MemTypeInfo.c + Ia32X64/Platform.c + Ia32X64/Platform.h + Ia32X64/IntelTdx.c [Packages] EmbeddedPkg/EmbeddedPkg.dec @@ -57,14 +57,16 @@ [LibraryClasses] PeiServicesLib PeiServicesTablePointerLib PeimEntryPoint + PcdLib + PlatformInitLib + +[LibraryClasses.IA32, LibraryClasses.X64] + MtrrLib + VmgExitLib QemuFwCfgLib QemuFwCfgS3Lib QemuFwCfgSimpleParserLib - MtrrLib MemEncryptSevLib - PcdLib - VmgExitLib - PlatformInitLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase @@ -99,7 +101,6 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved - gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable @@ -116,6 +117,9 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask +[Pcd.IA32, Pcd.X64] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode + [FixedPcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidSize diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Ia32X64/Platform.h similarity index 100% rename from OvmfPkg/PlatformPei/Platform.h rename to OvmfPkg/PlatformPei/Ia32X64/Platform.h diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/Ia32X64/AmdSev.c similarity index 100% rename from OvmfPkg/PlatformPei/AmdSev.c rename to OvmfPkg/PlatformPei/Ia32X64/AmdSev.c diff --git a/OvmfPkg/PlatformPei/ClearCache.c b/OvmfPkg/PlatformPei/Ia32X64/ClearCache.c similarity index 100% rename from OvmfPkg/PlatformPei/ClearCache.c rename to OvmfPkg/PlatformPei/Ia32X64/ClearCache.c diff --git a/OvmfPkg/PlatformPei/FeatureControl.c b/OvmfPkg/PlatformPei/Ia32X64/FeatureControl.c similarity index 100% rename from OvmfPkg/PlatformPei/FeatureControl.c rename to OvmfPkg/PlatformPei/Ia32X64/FeatureControl.c diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Ia32X64/Fv.c similarity index 100% rename from OvmfPkg/PlatformPei/Fv.c rename to OvmfPkg/PlatformPei/Ia32X64/Fv.c diff --git a/OvmfPkg/PlatformPei/IntelTdx.c b/OvmfPkg/PlatformPei/Ia32X64/IntelTdx.c similarity index 100% rename from OvmfPkg/PlatformPei/IntelTdx.c rename to OvmfPkg/PlatformPei/Ia32X64/IntelTdx.c diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/Ia32X64/MemDetect.c similarity index 100% rename from OvmfPkg/PlatformPei/MemDetect.c rename to OvmfPkg/PlatformPei/Ia32X64/MemDetect.c diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/Ia32X64/MemTypeInfo.c similarity index 100% rename from OvmfPkg/PlatformPei/MemTypeInfo.c rename to OvmfPkg/PlatformPei/Ia32X64/MemTypeInfo.c diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Ia32X64/Platform.c similarity index 100% rename from OvmfPkg/PlatformPei/Platform.c rename to OvmfPkg/PlatformPei/Ia32X64/Platform.c -- 2.38.0