From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mx.groups.io with SMTP id smtpd.web08.5675.1665655132153386756 for ; Thu, 13 Oct 2022 02:58:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=akEYx3s9; spf=pass (domain: ventanamicro.com, ip: 209.85.215.169, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pg1-f169.google.com with SMTP id s206so1144577pgs.3 for ; Thu, 13 Oct 2022 02:58:52 -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=6VFGHSzE0T+K9+4kpZTNlpjmjPeVsBbnwK5N1sh4cEs=; b=akEYx3s9B/raijZvUmpXCMp7t6ggtqH+HbTH708MEG7WWXCPkCpojo63v7vUuWcV8N GK2AOeBgnmWyZ3ckA/qbVcX1J/lZA5zAxqimbzxy1AO3kEddrHsdEh/oMvLp6CiP8l2A U3o+pTLo/rqP/vJB8adchOeRjHodAuNlaUiGSGHluGGwCS8c06OfuCl7TJBAmLyP7v2K UJvA0taaK1qaAHM3IHSaX0vZTAwF7FYzEw3pff02urAwYi38DONanq2ZdM32+nyPVb4X 8dwPdwSKPl4CBdG6L789m2AI0L9fvFFNqC3t3EHE+9CJ6s5QvWnOYHky8tYZ28k14o6n vkuA== 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=6VFGHSzE0T+K9+4kpZTNlpjmjPeVsBbnwK5N1sh4cEs=; b=OxpJI5aAsI6LraYD+mV5emIcVlNFhdqboLNK63gmUotsUQdIiZD6bCJYr6/3Hsi7ZB YYZcTQ+Q9unfWE+oldwWLIZn4Umeq56+rjfTspM/UuyjWww74UDGZVmfEOJ27UJpLS5j XpiqAJAKwVD6IiruSGimjPruw8PDpxgz8jZGZeuFlfICMIdF345i5MZN5NTorhWaR7RT tP8tBtKi1T8UVzEpA38HJ4ZVzQa4bDvv7BEk9cRhMi6D4cnCglgZu/fgHHJg9uwip9T6 ledbT0HTJBjqhXIWNam9OdxmrnpHCmoUWNrjpysSb2E5vcpusZPAwv8d2QYNJkGj8EfM PciQ== X-Gm-Message-State: ACrzQf0cdKpBq+B0HmpMZWPkB3xSKQMWQg+IiEtDQSsxil+kv7oTd+pV 8VhbHiw7ifO+ejZ8EuvRGZZZkZmgjhb2Sg== X-Google-Smtp-Source: AMsMyM4p1jYNVBCGpc4BiRvuva3srheFuUVL3OX5c+9p+rqR13aHdiFCr+UpsTnIdy93iU58NT+fkw== X-Received: by 2002:a05:6a00:4214:b0:562:67d0:77e7 with SMTP id cd20-20020a056a00421400b0056267d077e7mr36552536pfb.62.1665655131364; Thu, 13 Oct 2022 02:58:51 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([49.206.13.138]) by smtp.gmail.com with ESMTPSA id w8-20020a17090abc0800b0020d43c5c9a0sm2931845pjr.18.2022.10.13.02.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 02:58:50 -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 V3 05/34] OvmfPkg/PlatformInitLib: Refactor to allow other architectures Date: Thu, 13 Oct 2022 15:28:00 +0530 Message-Id: <20221013095829.1454581-6-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221013095829.1454581-1-sunilvl@ventanamicro.com> References: <20221013095829.1454581-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076 Currently, PlatformInitLib supports only X86 architecture. So, refactor to allow adding other architectures like RISC-V. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Sunil V L --- .../PlatformInitLib/PlatformInitLib.inf | 22 ++++++++++--------- .../PlatformInitLib/{ => Ia32_X64}/Cmos.c | 0 .../PlatformInitLib/{ => Ia32_X64}/IntelTdx.c | 0 .../{ => Ia32_X64}/IntelTdxNull.c | 0 .../{ => Ia32_X64}/MemDetect.c | 0 .../PlatformInitLib/{ => Ia32_X64}/Platform.c | 0 6 files changed, 12 insertions(+), 10 deletions(-) rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Cmos.c (100%) rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdx.c (100%) rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdxNull.c (100%) rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/MemDetect.c (100%) rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Platform.c (100%) diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf index 86a82ad3e084..d4449e40af61 100644 --- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf +++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf @@ -22,16 +22,16 @@ [Defines] # VALID_ARCHITECTURES = IA32 X64 EBC # -[Sources] - Cmos.c - MemDetect.c - Platform.c +[Sources.IA32, Sources.X64] + Ia32_X64/Cmos.c + Ia32_X64/MemDetect.c + Ia32_X64/Platform.c [Sources.IA32] - IntelTdxNull.c + Ia32_X64/IntelTdxNull.c [Sources.X64] - IntelTdx.c + Ia32_X64/IntelTdx.c [Packages] EmbeddedPkg/EmbeddedPkg.dec @@ -45,12 +45,14 @@ [LibraryClasses] DebugLib IoLib HobLib + PcdLib + PciLib + +[LibraryClasses.IA32, LibraryClasses.X64] + MtrrLib QemuFwCfgLib QemuFwCfgSimpleParserLib MemoryAllocationLib - MtrrLib - PcdLib - PciLib PeiHardwareInfoLib [LibraryClasses.X64] @@ -100,5 +102,5 @@ [FixedPcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase gUefiOvmfPkgTokenSpaceGuid.PcdCfvRawDataSize -[FeaturePcd] +[FeaturePcd.IA32, FeaturePcd.X64] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode diff --git a/OvmfPkg/Library/PlatformInitLib/Cmos.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/Cmos.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/Cmos.c rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/Cmos.c diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdx.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/IntelTdx.c rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdx.c diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdxNull.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdxNull.c diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/MemDetect.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/MemDetect.c rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/MemDetect.c diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/Platform.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/Platform.c rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/Platform.c -- 2.25.1