From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mx.groups.io with SMTP id smtpd.web10.9637.1665766134582756453 for ; Fri, 14 Oct 2022 09:48:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=O9vwl99Q; spf=pass (domain: ventanamicro.com, ip: 209.85.215.172, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pg1-f172.google.com with SMTP id r18so4754770pgr.12 for ; Fri, 14 Oct 2022 09:48:54 -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=bxsrW5pgUzOYiVb7HKuttwptY3VHTSaB2WgNekfcmt4=; b=O9vwl99QugbpdMRhue24PwPVBYUzA9nZxGvAyLJo85LPSiJ/3db4L+tu/jWmWXBo3N va6pMNVXykMFFs41J09VEYEF+r9LEt59dFiqfR5A1mrdE95SrSN492BrVmHLKm3Ha0TX /fr4UbUo4UHK26IfK3yyWrmVGitdnFwLSPjzUF8DWB/jsWOlnA07PmS30MqPWIfFHd4K s4mjF9LzyEFNMP1NeHzAeh1jLF2bUS88alamZQMDDExf8ETvzCEsFpB3KzI3Rwn3DKKX 3M9BI9n25TxS9BpFIYQ8JjJ2txjvcXH8vgynfrgd7Ui1CR8AykqWeLIMLGJB5aWb3VJK x1wA== 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=bxsrW5pgUzOYiVb7HKuttwptY3VHTSaB2WgNekfcmt4=; b=MWeakV/xoO/ru+WWriLUa4sIaE81EV0obxBsPqD7MU57/Hz3b6Te0SWHzFE55dA+DO r9pMKDN+hCMZxoenMAXeHj5iBhCOVF7ZVofKK4ZyvewGrIONQwp3emRDU4c/okKbnFdL PPdj9uLqZy49hwDkYm9u00IiLm+V2GuXa93+6NOraXRDefnUZ09XNAkgbtjtBaflwQK8 gDBn2A3UoiT9bvkD6eZtd/fsK/fWX5oYmWC+kX42AIDUiM/WoiLLK1QT4fa0BUj4J8iC UQyuhtMU+VIZXi4+4fOwEI2r1ULRt8Nr178iHv1ehBbzxsxqhm/rnXnseJSZpfEbJini FDhw== X-Gm-Message-State: ACrzQf0paqtOYIqy4Ib4+X9fashPs8jRXxM4XRGBAXFCYGrnrTUIRyBq aYGsFMYav6UXz479+22v7ge1Y3SjyxhtYg== X-Google-Smtp-Source: AMsMyM7o6mOzkvyjx5ZXdY6kKsz5nT3BO3Q3HERREnvrVBnwrmNnPfT7ZFSkgEPAPNGdD8NSeVaaZQ== X-Received: by 2002:a63:8:0:b0:460:e669:a0c4 with SMTP id 8-20020a630008000000b00460e669a0c4mr5342721pga.475.1665766133751; Fri, 14 Oct 2022 09:48:53 -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.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 09:48:53 -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 05/34] OvmfPkg/PlatformInitLib: Refactor to allow other architectures Date: Fri, 14 Oct 2022 22:18:07 +0530 Message-Id: <20221014164836.1513036-6-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, 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 --- OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 22 +++++++++++--------- OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Cmos.c | 0 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdx.c | 0 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdxNull.c | 0 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/MemDetect.c | 0 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Platform.c | 0 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf index 86a82ad3e084..5d31cad1b670 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] + Ia32X64/Cmos.c + Ia32X64/MemDetect.c + Ia32X64/Platform.c [Sources.IA32] - IntelTdxNull.c + Ia32X64/IntelTdxNull.c [Sources.X64] - IntelTdx.c + Ia32X64/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/Ia32X64/Cmos.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/Cmos.c rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Cmos.c diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/IntelTdx.c rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/MemDetect.c rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c similarity index 100% rename from OvmfPkg/Library/PlatformInitLib/Platform.c rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c -- 2.38.0