From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mx.groups.io with SMTP id smtpd.web11.4505.1665396744672418887 for ; Mon, 10 Oct 2022 03:12:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=D0hOFICv; spf=pass (domain: ventanamicro.com, ip: 209.85.216.48, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pj1-f48.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so12661222pjq.3 for ; Mon, 10 Oct 2022 03:12:24 -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=D0hOFICvJIJ6f+d92pnxtSF5tZUF3K+Ts9UL1uuLv1U72lq4l3sDB8ylkBQvfEfSAN rKEo/3baIAKaZbCBZ8RVErcebcNRk53mlQaf0l3yIlUZbSPNNafuBLxH3SCLC5yOA4iK Nh2F7p6Jz2SjUl8RWjrUVSKdaz0NfWR1SLTh/89JVr/dTGpWrAhyp1swrRWG7p29PaQH SyoCY2AK0EDuRcDlfSJtFh2ipHNcEDD1DLNMMbZ/Orz2CR1vZrliJmD/cgP3ywMXN5kK WGZZCuZOYpi5cit/Qf+D0Dk5dU0LgeZjRU5fTc0f5EmgBeyZXN5tmuL7h2pk6yZsbmrn hLww== 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=gd0Oh2v0pequYd8rS1M6eZfS/ie5tHN7H8JX4obRrnk+o94j7abyLl34QUlsfXL54Y rf6qbWnvHJOAg3Dpq0KrFTsoOfZvzGRZn8ENFUu7m+iLx2dVTxhmWQiy3Xi19UwskSvR +jFTTnnwDFXrGlXl3T46x5CdeqxF9nuI9zHxXUDGAMZfoJ3MtFK574n33Lon93wMdFx/ T4tukKseKLkkA9PV+nKkIqfO8/0obLxRKaZQ/CCSxka9Y6cCWhdZPi7MXAUh3MsxN6pQ 3ICqmR1utKbf20DEqNCKeq25yO7jMEsVf2iWOkgKje+HR5PBCPMuEWbvEzIUxUhgfCcz sG7g== X-Gm-Message-State: ACrzQf3jDrUibYCIjv69rNZtAlZqnMSRx3w5Yc8/CCh7juQnUUQ6GIPp +vt9xjPKOim4E5vfx+snkzttTCu5jyW/jA== X-Google-Smtp-Source: AMsMyM44dSj13MSHwFoiCU70W0A3as8q2GEwBYbByBKjwpF+iwVjoJWf20BiUQDPYKumbpuTgnRSvw== X-Received: by 2002:a17:90a:b013:b0:20a:e33d:dfa0 with SMTP id x19-20020a17090ab01300b0020ae33ddfa0mr20273984pjq.82.1665396743951; Mon, 10 Oct 2022 03:12:23 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([49.206.13.138]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001788ccecbf5sm6302138plf.31.2022.10.10.03.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 03:12:23 -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 05/29] OvmfPkg/PlatformInitLib: Refactor to allow other architectures Date: Mon, 10 Oct 2022 15:41:38 +0530 Message-Id: <20221010101202.1146624-6-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010101202.1146624-1-sunilvl@ventanamicro.com> References: <20221010101202.1146624-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