From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mx.groups.io with SMTP id smtpd.web11.18719.1665571519638648849 for ; Wed, 12 Oct 2022 03:45:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Xkny9qQc; spf=pass (domain: ventanamicro.com, ip: 209.85.210.175, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pf1-f175.google.com with SMTP id i3so16109420pfk.9 for ; Wed, 12 Oct 2022 03:45:19 -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=Xkny9qQceKWbYbq8b7AnfPh/indK19w8Huf6QSBAGS7KorwZdYgS3WXECfEy0NPy+K R5gzAkRGHoRkMHg8YO9JdDoSayD1sAIM47Emq0jvg0JtmYkl87888d513ds5Bs+ufl/Q 2N2GevhfnbqyD/8QvpYCz/CS2Z5/vSA8lbWzvQl5uD7UkCD6Rt9pW7DmDbeFayAw0VFH jmMSnRamZrGAfOmrhFUewAn5b7WnW/aRfrB6Q7WkZsJrOeJlaFpOBBkyz883skSZ7jfd 1yqdejS0QqX6CXWbTnJlmjSmjPqp2fDwNjY+oFF+d1j79sdPhFTLJjZDBqCxlHoDydb5 sMVQ== 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=1LoauU0F+RrDXWiZrGA3+TM/0D9Q68NEMDQ8kHB4z4dd+BDJHlHSPxuF+tCyN819ze I9E18HUOZMv+dJUQ+vV+8K9cTjNYyAxnoXyLVJGVXkn61/amucnkhaXkK2O36DmjTya2 7QQfl9+OhQQScDGWfohdaR0aFe/Flm1DOGc0kkb9YvKPKmneeRRgIQVX/puZg3HXX24T LRJNdhU4kd92MaF2ZR9zVvH5MJ3PKFJYiTCsboc17JvTPgaWE4p693xyj9oG+myJde7p oUCHDR7d8AY/f8U4tqSNu3bYvLD+c7wSej4F9VL/3uX5gB5l/kOdtg/jLduVmFzqACfC tdkg== X-Gm-Message-State: ACrzQf2AKafjtAda3iPV8YppGkM/UqIpxhhgG1VwTlqQBkN1NYfIY4Z+ ulEgkD7tuNzhuDA5OvQWrx3fk0o6R5UhUg== X-Google-Smtp-Source: AMsMyM6/9/bQKkF9+1EDijFx47FHbItftPrOe+G4wAIpGKFQEAUJ7W508+VcuDwyP+7+EkDP4Oq3ZQ== X-Received: by 2002:a05:6a00:1a93:b0:565:b185:cc18 with SMTP id e19-20020a056a001a9300b00565b185cc18mr1690704pfv.70.1665571518925; Wed, 12 Oct 2022 03:45:18 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([49.206.13.138]) by smtp.gmail.com with ESMTPSA id z4-20020aa79e44000000b0054223a0185asm10812221pfq.161.2022.10.12.03.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 03:45:18 -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 V2 05/33] OvmfPkg/PlatformInitLib: Refactor to allow other architectures Date: Wed, 12 Oct 2022 16:14:28 +0530 Message-Id: <20221012104456.1393376-6-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221012104456.1393376-1-sunilvl@ventanamicro.com> References: <20221012104456.1393376-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