From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88013+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88013+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192608; cv=none; d=zohomail.com; s=zohoarc; b=UUbBJM3Qu6YkD7FrCLw4ZtAQtZ1MaPnvMXUHgjha7g0Jf2gST/oVL9OAoGmHYtBIHZwFx/FiwK1ju1P7xMdPbSVk7f/kYmQOJSBUxuMBJ700KHbanUgWpQ4/aQBi1Cb0SwklbouWsbUfa4992STKu5VHJ/R2+eImG+kGL29V8co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192608; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=AACdr3ToxuOYJ/Lhqgh0yxeHtX/VAzst5J8e8Kj3pLY=; b=I1XBC8NuHroiakO+YKtQ+G8eO1JWBC3Zjappwf1R2BJKryMi1bG1hdoryWgjUkZt4e67g0EpgI5VK4bzVtl0nLNAeBE6ySDiCCnh3nWfiXg3pQM0OxE95tBKYNCcMW2dpzlRKIG3nNeAqxqEJlrOD3Reocg3g8os+Oyv/a/Y3gU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88013+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192608501148.1727674789953; Fri, 25 Mar 2022 00:16:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hNS9YY1788612xCNojlFeujx; Fri, 25 Mar 2022 00:16:48 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web12.2452.1648192607246040730 for ; Fri, 25 Mar 2022 00:16:47 -0700 X-Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P6QtEP032524; Fri, 25 Mar 2022 07:16:44 GMT X-Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f18fqrg93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:44 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 7DBF18D; Fri, 25 Mar 2022 07:16:43 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 48C8047; Fri, 25 Mar 2022 07:16:41 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Eric Dong , Ray Ni , Rahul Kumar , Sunil V L , Andrew Fish , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 1/8] [RFC] UefiCpuPkg: Classify IA32/X64 modules in DSC file Date: Fri, 25 Mar 2022 14:12:42 +0800 Message-Id: <20220325061249.30626-2-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-GUID: Fv5EJw6ujvNij_P47GlmAIWFWaDwL4fF X-Proofpoint-ORIG-GUID: Fv5EJw6ujvNij_P47GlmAIWFWaDwL4fF X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: JXlog9zK6uy6tUfGiTNul5bnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192608; bh=Qyffhj56qbyUC3yJ7dGzj70FSJpJrTJR5hKc3o0tct0=; h=Cc:Date:From:Reply-To:Subject:To; b=dQr3RRZ2SGzQ/Z4HjrjxCdiHvL1Oy0L8pnHYNwPJwo6oK12261tFIGSRJ26jPTnR5lA k5/Sh0AZ4wPCTj+FRISN8nAqYoaybmx1WnQ1m3WOBCGKABtvNZg0/lhk+twtSTgWIzIdb Iz/i8f8fvz6pSOSwWxpB8tbU9ZhyvLut224= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192609553100001 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 This is the first step of reworking on UefiCpuPkg in order to accommodating all processor architectures in UEfiCpuPkg. Classify UefiCpuPkg modules to IA32 and X64 sections in DSC file. Move the module to Common section if more than one archs can leverage the same module. Such as the patch 3/6 for BaseUefiCpuLib. Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Sunil V L Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- UefiCpuPkg/UefiCpuPkg.dsc | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index a0bbde9985..6b43ff6822 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -2,6 +2,7 @@ # UefiCpuPkg Package # # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2022 Hewlett Packard Enterprise Development LP. All right= s reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -23,7 +24,7 @@ =20 !include MdePkg/MdeLibs.dsc.inc =20 -[LibraryClasses] +[LibraryClasses.common] BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf @@ -31,9 +32,7 @@ SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull= .inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf @@ -47,48 +46,56 @@ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf - LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf - SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCp= uPlatformHookLibNull.inf - SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib= .inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeC= offExtraActionLibNull.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + +[LibraryClasses.IA32, LibraryClasses.X64] + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf + SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCp= uPlatformHookLibNull.inf + SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib= .inf VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SEC] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + +[LibraryClasses.IA32.SEC, LibraryClasses.X64.SEC] PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.= inf !if $(TOOL_CHAIN_TAG) =3D=3D "XCODE5" CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5S= ecPeiCpuExceptionHandlerLib.inf !else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf !endif - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf =20 [LibraryClasses.common.PEIM] MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf - MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf - RegisterCpuFeaturesLib|UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegi= sterCpuFeaturesLib.inf - CpuCacheInfoLib|UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf =20 [LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM] PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuE= xceptionHandlerLib.inf + MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf + RegisterCpuFeaturesLib|UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegi= sterCpuFeaturesLib.inf + CpuCacheInfoLib|UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf =20 [LibraryClasses.common.DXE_DRIVER] MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + +[LibraryClasses.IA32.DXE_DRIVER, LibraryClasses.X64.DXE_DRIVER] CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf RegisterCpuFeaturesLib|UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegi= sterCpuFeaturesLib.inf @@ -99,6 +106,8 @@ MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.= inf MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + +[LibraryClasses.IA32.DXE_SMM_DRIVER, LibraryClasses.X64.DXE_SMM_DRIVER] CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuE= xceptionHandlerLib.inf =20 [LibraryClasses.common.MM_STANDALONE] @@ -112,7 +121,7 @@ # Drivers/Libraries within this package # =20 -[Components] +[Components.IA32, Components.X64] UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf UefiCpuPkg/CpuIoPei/CpuIoPei.inf UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/SecPeiDxeTimerLibUefiCpu.inf @@ -122,7 +131,6 @@ UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.inf =20 -[Components.IA32, Components.X64] UefiCpuPkg/CpuDxe/CpuDxe.inf UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf { --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88013): https://edk2.groups.io/g/devel/message/88013 Mute This Topic: https://groups.io/mt/90017678/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88014+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88014+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192610; cv=none; d=zohomail.com; s=zohoarc; b=LiZfYrwUIv5MbmigjHDaiW53z9ZtIBWa3UGtFpHbKbq2l8KbTX6U/HPeVYwAlXPmHXDuf6RWRfOej2vqfSrQoOqcR05G3z6aOtzdukB2XkLFs5SjTbXX3oB1VxezU/Ii+JVmss2QcXjGLf6DeCDECvu1BqC5pL5XTNIc6PxXOtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192610; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=RgTiN0viHxEckZTtgSTGiAlfIidihCIB6U/JH/306J8=; b=Vf/R8+5dNlxfmFR+a/8qIkmXmcJZ0b3LS7lVQ5wNKHTWTgHE588GBUJ/lVe5uS1Uo18Al2wOd5fy+Gv3LvF2hLP0GT8XsCnFSLgBP8NubwLREFTJafqDevNtOiMMKiJfJ9TRYHuif8gVgj0nMHF69YeL2bJWx3XBY/akQ/7PhSA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88014+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192610603271.7175836741503; Fri, 25 Mar 2022 00:16:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XK4dYY1788612xKiL0aP6HwY; Fri, 25 Mar 2022 00:16:50 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.2324.1648192609318382827 for ; Fri, 25 Mar 2022 00:16:49 -0700 X-Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P6QqU7032494; Fri, 25 Mar 2022 07:16:46 GMT X-Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f18fqrg97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:46 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 09047A1; Fri, 25 Mar 2022 07:16:46 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id CBCD147; Fri, 25 Mar 2022 07:16:43 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Eric Dong , Ray Ni , Rahul Kumar , Daniel Schaefer , Sunil V L , Andrew Fish , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 2/8] [RFC] UefiCpuPkg/Include: Add header files of RISC-V processor architecture Date: Fri, 25 Mar 2022 14:12:43 +0800 Message-Id: <20220325061249.30626-3-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-GUID: tX1NU2ChEIAuc3JccPBJo6BJcsZSHJB8 X-Proofpoint-ORIG-GUID: tX1NU2ChEIAuc3JccPBJo6BJcsZSHJB8 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: 3GKN5WHKWXm6FMS49n1eoIVQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192610; bh=sG/3TRmOX8Hu9a05nzImJBTdCFVgiQTfWeFTFQ56dhc=; h=Cc:Date:From:Reply-To:Subject:To; b=QP4ROklD8pBWqF4Fs3qeX8RhBQKFWY5qjR05tMQwEUiHh2YUJrSd4KgH5yo0bAF6GaJ YdD9+QfJdyz+J7ERNLbh0DzHIro8U5Yqm3IQY1kfOD6cT9rxaMBkVplhpy9HAr3s2mB3o chV3DziieDYY+zkEop4De0Hu39R/M3JlS2Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192611521100007 Content-Type: text/plain; charset="utf-8" (This is migrated from edk2-platforms:Silicon/RISC-V) https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 RISC-V processor architecture definitions. Signed-off-by: Abner Chang Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Daniel Schaefer Cc: Sunil V L Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- .../Include/IndustryStandard/RISC-V/RiscV.h | 162 ++++++++++++++++++ UefiCpuPkg/Include/RISC-V/RiscVImpl.h | 87 ++++++++++ 2 files changed, 249 insertions(+) create mode 100644 UefiCpuPkg/Include/IndustryStandard/RISC-V/RiscV.h create mode 100644 UefiCpuPkg/Include/RISC-V/RiscVImpl.h diff --git a/UefiCpuPkg/Include/IndustryStandard/RISC-V/RiscV.h b/UefiCpuPk= g/Include/IndustryStandard/RISC-V/RiscV.h new file mode 100644 index 0000000000..3edd1e6263 --- /dev/null +++ b/UefiCpuPkg/Include/IndustryStandard/RISC-V/RiscV.h @@ -0,0 +1,162 @@ +/** @file + RISC-V processor architecture definitions. + + Copyright (c) 2022 Hewlett Packard Enterprise Development LP. All rights= reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef RISCV_INDUSTRY_STANDARD_H_ +#define RISCV_INDUSTRY_STANDARD_H_ + +#if defined (MDE_CPU_RISCV64) +#define RISC_V_XLEN_BITS 64 +#else +#endif + +#define RISC_V_ISA_ATOMIC_EXTENSION (0x00000001 = << 0) +#define RISC_V_ISA_BIT_OPERATION_EXTENSION (0x00000001 = << 1) +#define RISC_V_ISA_COMPRESSED_EXTENSION (0x00000001 = << 2) +#define RISC_V_ISA_DOUBLE_PRECISION_FP_EXTENSION (0x00000001 = << 3) +#define RISC_V_ISA_RV32E_ISA (0x00000001 = << 4) +#define RISC_V_ISA_SINGLE_PRECISION_FP_EXTENSION (0x00000001 = << 5) +#define RISC_V_ISA_ADDITIONAL_STANDARD_EXTENSION (0x00000001 = << 6) +#define RISC_V_ISA_RESERVED_1 (0x00000001 = << 7) +#define RISC_V_ISA_INTEGER_ISA_EXTENSION (0x00000001 = << 8) +#define RISC_V_ISA_DYNAMICALLY_TRANSLATED_LANGUAGE_EXTENSION (0x00000001 = << 9) +#define RISC_V_ISA_RESERVED_2 (0x00000001 = << 10) +#define RISC_V_ISA_DECIMAL_FP_EXTENSION (0x00000001 = << 11) +#define RISC_V_ISA_INTEGER_MUL_DIV_EXTENSION (0x00000001 = << 12) +#define RISC_V_ISA_USER_LEVEL_INTERRUPT_SUPPORTED (0x00000001 = << 13) +#define RISC_V_ISA_RESERVED_3 (0x00000001 = << 14) +#define RISC_V_ISA_PACKED_SIMD_EXTENSION (0x00000001 = << 15) +#define RISC_V_ISA_QUAD_PRECISION_FP_EXTENSION (0x00000001 = << 16) +#define RISC_V_ISA_RESERVED_4 (0x00000001 = << 17) +#define RISC_V_ISA_SUPERVISOR_MODE_IMPLEMENTED (0x00000001 = << 18) +#define RISC_V_ISA_TRANSATIONAL_MEMORY_EXTENSION (0x00000001 = << 19) +#define RISC_V_ISA_USER_MODE_IMPLEMENTED (0x00000001 = << 20) +#define RISC_V_ISA_VECTOR_EXTENSION (0x00000001 = << 21) +#define RISC_V_ISA_RESERVED_5 (0x00000001 = << 22) +#define RISC_V_ISA_NON_STANDARD_EXTENSION (0x00000001 = << 23) +#define RISC_V_ISA_RESERVED_6 (0x00000001 = << 24) +#define RISC_V_ISA_RESERVED_7 (0x00000001 = << 25) + +// +// RISC-V CSR definitions. +// +// +// Machine information +// +#define RISCV_CSR_MACHINE_MVENDORID 0xF11 +#define RISCV_CSR_MACHINE_MARCHID 0xF12 +#define RISCV_CSR_MACHINE_MIMPID 0xF13 +#define RISCV_CSR_MACHINE_HARRID 0xF14 +// +// Machine Trap Setup. +// +#define RISCV_CSR_MACHINE_MSTATUS 0x300 +#define RISCV_CSR_MACHINE_MISA 0x301 +#define RISCV_CSR_MACHINE_MEDELEG 0x302 +#define RISCV_CSR_MACHINE_MIDELEG 0x303 +#define RISCV_CSR_MACHINE_MIE 0x304 +#define RISCV_CSR_MACHINE_MTVEC 0x305 + +#define RISCV_TIMER_COMPARE_BITS 32 +// +// Machine Timer and Counter. +// +// #define RISCV_CSR_MACHINE_MTIME 0x701 +// #define RISCV_CSR_MACHINE_MTIMEH 0x741 +// +// Machine Trap Handling. +// +#define RISCV_CSR_MACHINE_MSCRATCH 0x340 +#define RISCV_CSR_MACHINE_MEPC 0x341 +#define RISCV_CSR_MACHINE_MCAUSE 0x342 +#define MACHINE_MCAUSE_EXCEPTION_ MASK 0x0f +#define MACHINE_MCAUSE_INTERRUPT (RISC_V_XLEN_BITS - 1) +#define RISCV_CSR_MACHINE_MBADADDR 0x343 +#define RISCV_CSR_MACHINE_MIP 0x344 + +// +// Machine Protection and Translation. +// +#define RISCV_CSR_MACHINE_MBASE 0x380 +#define RISCV_CSR_MACHINE_MBOUND 0x381 +#define RISCV_CSR_MACHINE_MIBASE 0x382 +#define RISCV_CSR_MACHINE_MIBOUND 0x383 +#define RISCV_CSR_MACHINE_MDBASE 0x384 +#define RISCV_CSR_MACHINE_MDBOUND 0x385 + +// +// Supervisor mode CSR. +// +#define RISCV_CSR_SUPERVISOR_SSTATUS 0x100 +#define SSTATUS_SIE_BIT_POSITION 1 +#define SSTATUS_SPP_BIT_POSITION 8 +#define RISCV_CSR_SUPERVISOR_SIE 0x104 +#define RISCV_CSR_SUPERVISOR_STVEC 0x105 +#define RISCV_CSR_SUPERVISOR_SSCRATCH 0x140 +#define RISCV_CSR_SUPERVISOR_SEPC 0x141 +#define RISCV_CSR_SUPERVISOR_SCAUSE 0x142 +#define SCAUSE_USER_SOFTWARE_INT 0 +#define SCAUSE_SUPERVISOR_SOFTWARE_INT 1 +#define SCAUSE_USER_TIMER_INT 4 +#define SCAUSE_SUPERVISOR_TIMER_INT 5 +#define SCAUSE_USER_EXTERNAL_INT 8 +#define SCAUSE_SUPERVISOR_EXTERNAL_INT 9 +#define RISCV_CSR_SUPERVISOR_STVAL 0x143 +#define RISCV_CSR_SUPERVISOR_SIP 0x144 +#define RISCV_CSR_SUPERVISOR_SATP 0x180 + +#if defined (MDE_CPU_RISCV64) +#define RISCV_SATP_MODE_MASK 0xF000000000000000 +#define RISCV_SATP_MODE_BIT_POSITION 60 +#endif +#define RISCV_SATP_MODE_OFF 0 +#define RISCV_SATP_MODE_SV32 1 +#define RISCV_SATP_MODE_SV39 8 +#define RISCV_SATP_MODE_SV48 9 +#define RISCV_SATP_MODE_SV57 10 +#define RISCV_SATP_MODE_SV64 11 + +#define SATP64_ASID_MASK 0x0FFFF00000000000 +#define SATP64_PPN_MASK 0x00000FFFFFFFFFFF + +#define RISCV_CAUSE_MISALIGNED_FETCH 0x0 +#define RISCV_CAUSE_FETCH_ACCESS 0x1 +#define RISCV_CAUSE_ILLEGAL_INSTRUCTION 0x2 +#define RISCV_CAUSE_BREAKPOINT 0x3 +#define RISCV_CAUSE_MISALIGNED_LOAD 0x4 +#define RISCV_CAUSE_LOAD_ACCESS 0x5 +#define RISCV_CAUSE_MISALIGNED_STORE 0x6 +#define RISCV_CAUSE_STORE_ACCESS 0x7 +#define RISCV_CAUSE_USER_ECALL 0x8 +#define RISCV_CAUSE_HYPERVISOR_ECALL 0x9 +#define RISCV_CAUSE_SUPERVISOR_ECALL 0xa +#define RISCV_CAUSE_MACHINE_ECALL 0xb +#define RISCV_CAUSE_FETCH_PAGE_FAULT 0xc +#define RISCV_CAUSE_LOAD_PAGE_FAULT 0xd +#define RISCV_CAUSE_STORE_PAGE_FAULT 0xf +#define RISCV_CAUSE_FETCH_GUEST_PAGE_FAULT 0x14 +#define RISCV_CAUSE_LOAD_GUEST_PAGE_FAULT 0x15 +#define RISCV_CAUSE_STORE_GUEST_PAGE_FAULT 0x17 + +// +// Machine Read-Write Shadow of Hypervisor Read-Only Registers +// +#define RISCV_CSR_HTIMEW 0xB01 +#define RISCV_CSR_HTIMEHW 0xB81 +// +// Machine Host-Target Interface (Non-Standard Berkeley Extension) +// +#define RISCV_CSR_MTOHOST 0x780 +#define RISCV_CSR_MFROMHOST 0x781 + +// +// User mode CSR +// +#define RISCV_CSR_CYCLE 0xc00 +#define RISCV_CSR_TIME 0xc01 +#endif diff --git a/UefiCpuPkg/Include/RISC-V/RiscVImpl.h b/UefiCpuPkg/Include/RIS= C-V/RiscVImpl.h new file mode 100644 index 0000000000..e49095de3d --- /dev/null +++ b/UefiCpuPkg/Include/RISC-V/RiscVImpl.h @@ -0,0 +1,87 @@ +/** @file + RISC-V processor implementation definitions. + + Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef RISCV_H_ +#define RISCV_H_ + +#include +#include + +#define _ASM_FUNC(Name, Section) \ + .global Name ; \ + .section #Section, "ax" ; \ + .type Name, %function ; \ + .p2align 2 ; \ + Name: + +#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name) + +#if defined (MDE_CPU_RISCV64) +typedef UINT64 RISC_V_REGS_PROTOTYPE; +#else +#endif + +// +// Structure for 128-bit value +// +typedef struct { + UINT64 Value64_L; + UINT64 Value64_H; +} RISCV_UINT128; + +#define RISCV_MACHINE_CONTEXT_SIZE 0x1000 +typedef struct _RISCV_MACHINE_MODE_CONTEXT RISCV_MACHINE_MODE_CONTEXT; + +/// +/// Exception handlers in context. +/// +typedef struct _EXCEPTION_HANDLER_CONTEXT { + EFI_PHYSICAL_ADDRESS InstAddressMisalignedHander; + EFI_PHYSICAL_ADDRESS InstAccessFaultHander; + EFI_PHYSICAL_ADDRESS IllegalInstHander; + EFI_PHYSICAL_ADDRESS BreakpointHander; + EFI_PHYSICAL_ADDRESS LoadAddrMisalignedHander; + EFI_PHYSICAL_ADDRESS LoadAccessFaultHander; + EFI_PHYSICAL_ADDRESS StoreAmoAddrMisalignedHander; + EFI_PHYSICAL_ADDRESS StoreAmoAccessFaultHander; + EFI_PHYSICAL_ADDRESS EnvCallFromUModeHander; + EFI_PHYSICAL_ADDRESS EnvCallFromSModeHander; + EFI_PHYSICAL_ADDRESS EnvCallFromHModeHander; + EFI_PHYSICAL_ADDRESS EnvCallFromMModeHander; +} EXCEPTION_HANDLER_CONTEXT; + +/// +/// Exception handlers in context. +/// +typedef struct _INTERRUPT_HANDLER_CONTEXT { + EFI_PHYSICAL_ADDRESS SoftwareIntHandler; + EFI_PHYSICAL_ADDRESS TimerIntHandler; +} INTERRUPT_HANDLER_CONTEXT; + +/// +/// Interrupt handlers in context. +/// +typedef struct _TRAP_HANDLER_CONTEXT { + EXCEPTION_HANDLER_CONTEXT ExceptionHandlerContext; + INTERRUPT_HANDLER_CONTEXT IntHandlerContext; +} TRAP_HANDLER_CONTEXT; + +/// +/// Machine mode context used for saveing hart-local context. +/// +typedef struct _RISCV_MACHINE_MODE_CONTEXT { + EFI_PHYSICAL_ADDRESS PeiService; /// PEI service. + EFI_PHYSICAL_ADDRESS MachineModeTrapHandler; /// Machine mode trap= handler. + EFI_PHYSICAL_ADDRESS HypervisorModeTrapHandler; /// Hypervisor mode t= rap handler. + EFI_PHYSICAL_ADDRESS SupervisorModeTrapHandler; /// Supervisor mode t= rap handler. + EFI_PHYSICAL_ADDRESS UserModeTrapHandler; /// USer mode trap ha= ndler. + TRAP_HANDLER_CONTEXT MModeHandler; /// Handler for machi= ne mode. +} RISCV_MACHINE_MODE_CONTEXT; + +#endif --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88014): https://edk2.groups.io/g/devel/message/88014 Mute This Topic: https://groups.io/mt/90017679/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88016+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88016+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192612; cv=none; d=zohomail.com; s=zohoarc; b=HsjCSr4aS6UV2igiJyA+/ky0JptHhIdsgiQwn8v+3V0OBE7zQm9+vuhAsakeHJrZbyO7DNMiUMk5LcJT2+qlgwCTBmVllBWfRU+WKaCXzAH8+6g6Hsa579iR6XkGytNlEZHVktVON6NQauv2qCkFpOvj5e87DAiPqmM13HO7vVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192612; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9ax8XhcSrdDPwJSfGkxcfP+y0ESP3+Oxo204JzADgWE=; b=Omgx/9vNVqBJYpa+UDtGZE7ScUUYaEFKNv6aTd3KD+luyEL9mB+lBLwrsIJvlY71XwoMkn6cTJNcerAdNw/XkC75VWPuWgT8gfYe9136059EHtM/exDPytZyN3naNN1kid29hxL6RIkxBXCaC3jbxD1OC+Ey2SypHj+5PpkoFIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88016+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192612439845.778715702255; Fri, 25 Mar 2022 00:16:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yH7cYY1788612xL9Pk2n33GW; Fri, 25 Mar 2022 00:16:52 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web08.2285.1648192611126353594 for ; Fri, 25 Mar 2022 00:16:51 -0700 X-Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P6O8xg006401; Fri, 25 Mar 2022 07:16:49 GMT X-Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f18eb0hrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:49 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id 8D2D45B; Fri, 25 Mar 2022 07:16:48 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 57B9346; Fri, 25 Mar 2022 07:16:46 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Eric Dong , Ray Ni , Rahul Kumar , Sunil V L , Andrew Fish , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 3/8] [RFC] UefiCpuPkg/BaseUefiCpuLib: Add RISC-V RISCV64 instace Date: Fri, 25 Mar 2022 14:12:44 +0800 Message-Id: <20220325061249.30626-4-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: HBtZnLpdNECFj7zLAsE2MZ-_fr1M5fWl X-Proofpoint-GUID: HBtZnLpdNECFj7zLAsE2MZ-_fr1M5fWl X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: KeEhcQsArkfn5eKxWuLzOsmpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192612; bh=rLndCxIvWDqnNmFdNB477/dj87JbFNZWENE9P3tzhAk=; h=Cc:Date:From:Reply-To:Subject:To; b=lSytBaG/JkaFXdEK1xlo/X3iKlQcy0ywOjR2syqgn/wHYz6JOpn8VFUepPoDfBFUqsa WLSSmhD0lR8WMziR418IlYxbBYMUOI6nsvsx9SDltWoXUcoKxNDfNwlQuYIgLJATzNnHD m52HDPdrgNOgEALpLh79qMuPUOQ9qV1fqw8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192613573100015 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 Add BaseUefiCpuLib instance for RISC-V RISCV64 arch. Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Sunil V L Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- UefiCpuPkg/UefiCpuPkg.dec | 17 ++- UefiCpuPkg/UefiCpuPkg.dsc | 7 +- .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf | 8 +- .../Include/Library/RISC-V/RiscVCpuLib.h | 118 +++++++++++++++ .../Library/BaseUefiCpuLib/BaseUefiCpuLib.uni | 5 +- .../Library/BaseUefiCpuLib/RISCV64/Cpu.S | 143 ++++++++++++++++++ 6 files changed, 286 insertions(+), 12 deletions(-) create mode 100644 UefiCpuPkg/Include/Library/RISC-V/RiscVCpuLib.h create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/RISCV64/Cpu.S diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 525cde4634..613881368b 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -2,6 +2,7 @@ # This Package provides UEFI compatible CPU modules and libraries. # # Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
+# Copyright (c) 2022 Hewlett Packard Enterprise Development LP. All rights= reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -18,17 +19,17 @@ Include =20 [LibraryClasses] - ## @libraryclass Defines some routines that are generic for IA32 famil= y CPU - ## to be UEFI specification compliant. - ## - UefiCpuLib|Include/Library/UefiCpuLib.h - ## @libraryclass Defines some routines that are used to register/manag= e/program ## CPU features. ## RegisterCpuFeaturesLib|Include/Library/RegisterCpuFeaturesLib.h =20 [LibraryClasses.IA32, LibraryClasses.X64] + ## @libraryclass Defines some routines that are generic for IA32 famil= y CPU + ## to be UEFI specification compliant. + ## + UefiCpuLib|Include/Library/UefiCpuLib.h + ## @libraryclass Provides functions to manage MTRR settings on IA32 an= d X64 CPUs. ## MtrrLib|Include/Library/MtrrLib.h @@ -65,6 +66,12 @@ ## @libraryclass Provides function for SMM CPU Rendezvous Library. SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h =20 +[LibraryClasses.RISCV64] + ## @libraryclass Defines some routines that are generic for RISC-V CPU + ## to be UEFI specification compliant. + ## + UefiCpuLib|Include/Library/RISC-V/RiscVCpuLib.h + [Guids] gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }} gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }} diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 6b43ff6822..50c9fc294c 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -14,7 +14,7 @@ PLATFORM_VERSION =3D 0.90 DSC_SPECIFICATION =3D 0x00010005 OUTPUT_DIRECTORY =3D Build/UefiCpu - SUPPORTED_ARCHITECTURES =3D IA32|X64 + SUPPORTED_ARCHITECTURES =3D IA32|X64|RISCV64 BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER =3D DEFAULT =20 @@ -55,9 +55,9 @@ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeC= offExtraActionLibNull.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf =20 [LibraryClasses.IA32, LibraryClasses.X64] - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCp= uPlatformHookLibNull.inf @@ -120,6 +120,8 @@ # # Drivers/Libraries within this package # +[Components.common] + UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf =20 [Components.IA32, Components.X64] UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf @@ -144,7 +146,6 @@ UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf UefiCpuPkg/CpuMpPei/CpuMpPei.inf UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf - UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpu= Pkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf index 34d3a7bb43..f43498e9b4 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf @@ -5,6 +5,7 @@ # # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
# Copyright (c) 2020, AMD Inc. All rights reserved.
+# Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -21,7 +22,7 @@ # # The following information is for reference only and not required by the = build tools. # -# VALID_ARCHITECTURES =3D IA32 X64 +# VALID_ARCHITECTURES =3D IA32 X64 RISCV64 # =20 [Sources.IA32] @@ -30,9 +31,12 @@ [Sources.X64] X64/InitializeFpu.nasm =20 -[Sources] +[Sources.IA32, Sources.X64] BaseUefiCpuLib.c =20 +[Sources.RISCV64] + RISCV64/Cpu.S + [Packages] MdePkg/MdePkg.dec UefiCpuPkg/UefiCpuPkg.dec diff --git a/UefiCpuPkg/Include/Library/RISC-V/RiscVCpuLib.h b/UefiCpuPkg/I= nclude/Library/RISC-V/RiscVCpuLib.h new file mode 100644 index 0000000000..610456d0be --- /dev/null +++ b/UefiCpuPkg/Include/Library/RISC-V/RiscVCpuLib.h @@ -0,0 +1,118 @@ +/** @file + RISC-V CPU library definitions. + + Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef RISCV_CPU_LIB_H_ +#define RISCV_CPU_LIB_H_ + +#include "RiscVImpl.h" + +/** + RISCV_TRAP_HANDLER +**/ +typedef +VOID +(EFIAPI *RISCV_TRAP_HANDLER)( + VOID + ); + +VOID +RiscVSetMachineScratch ( + RISCV_MACHINE_MODE_CONTEXT *RiscvContext + ); + +UINT32 +RiscVGetMachineScratch ( + VOID + ); + +UINT32 +RiscVGetMachineTrapCause ( + VOID + ); + +UINT64 +RiscVReadMachineTimer ( + VOID + ); + +UINT64 +RiscVReadMachineTimerInterface ( + VOID + ); + +VOID + RiscVSetMachineTimerCmp (UINT64); + +UINT64 +RiscVReadMachineTimerCmp ( + VOID + ); + +UINT64 +RiscVReadMachineInterruptEnable ( + VOID + ); + +UINT64 +RiscVReadMachineInterruptPending ( + VOID + ); + +UINT64 +RiscVReadMachineStatus ( + VOID + ); + +VOID + RiscVWriteMachineStatus (UINT64); + +UINT64 +RiscVReadMachineTrapVector ( + VOID + ); + +UINT64 +RiscVReadMachineIsa ( + VOID + ); + +UINT64 +RiscVReadMachineVendorId ( + VOID + ); + +UINT64 +RiscVReadMachineArchitectureId ( + VOID + ); + +UINT64 +RiscVReadMachineImplementId ( + VOID + ); + +VOID + RiscVSetSupervisorAddressTranslationRegister (UINT64); + +VOID + RiscVSetSupervisorScratch (UINT64); + +UINT64 +RiscVGetSupervisorScratch ( + VOID + ); + +VOID + RiscVSetSupervisorStvec (UINT64); + +UINT64 +RiscVGetSupervisorStvec ( + VOID + ); + +#endif diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni b/UefiCpu= Pkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni index 83c96cea67..a94bbef53e 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni @@ -4,13 +4,14 @@ // The library routines are UEFI specification compliant. // // Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+// Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
// // SPDX-License-Identifier: BSD-2-Clause-Patent // // **/ =20 =20 -#string STR_MODULE_ABSTRACT #language en-US "Defines generic r= outines for IA32 family CPUs." +#string STR_MODULE_ABSTRACT #language en-US "Base CPU library." =20 -#string STR_MODULE_DESCRIPTION #language en-US "The library routi= nes comply with the UEFI Specification." +#string STR_MODULE_DESCRIPTION #language en-US "Base CPU library = provides generic routines for specific CPU architecture." =20 diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/RISCV64/Cpu.S b/UefiCpuPkg/L= ibrary/BaseUefiCpuLib/RISCV64/Cpu.S new file mode 100644 index 0000000000..5bc31744db --- /dev/null +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/RISCV64/Cpu.S @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------= ------ +// +// RISC-V CPU functions. +// +// Copyright (c) 2022 Hewlett Packard Enterprise Development LP. All right= s reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +//------------------------------------------------------------------------= ------ +#include +#include + +.data + +.text +.align 3 + +// +// Set machine mode scratch. +// @param a0 : Pointer to RISCV_MACHINE_MODE_CONTEXT. +// +ASM_FUNC (RiscVSetMachineScratch) + csrrw a1, RISCV_CSR_MACHINE_MSCRATCH, a0 + ret + +// +// Get machine mode scratch. +// @retval a0 : Pointer to RISCV_MACHINE_MODE_CONTEXT. +// +ASM_FUNC (RiscVGetMachineScratch) + csrrs a0, RISCV_CSR_MACHINE_MSCRATCH, 0 + ret + +// +// Get machine trap cause CSR. +// +ASM_FUNC (RiscVGetMachineTrapCause) + csrrs a0, RISCV_CSR_MACHINE_MCAUSE, 0 + ret + +// +// Get machine interrupt enable +// +ASM_FUNC (RiscVReadMachineInterruptEnable) + csrr a0, RISCV_CSR_MACHINE_MIE + ret + +// +// Get machine interrupt pending +// +ASM_FUNC (RiscVReadMachineInterruptPending) + csrr a0, RISCV_CSR_MACHINE_MIP + ret + +// +// Get machine status +// +ASM_FUNC (RiscVReadMachineStatus) + csrr a0, RISCV_CSR_MACHINE_MSTATUS + ret + +// +// Set machine status +// +ASM_FUNC (RiscVWriteMachineStatus) + csrw RISCV_CSR_MACHINE_MSTATUS, a0 + ret + +// +// Get machine trap vector +// +ASM_FUNC (RiscVReadMachineTrapVector) + csrr a0, RISCV_CSR_MACHINE_MTVEC + ret + +// +// Read machine ISA +// +ASM_FUNC (RiscVReadMachineIsa) + csrr a0, RISCV_CSR_MACHINE_MISA + ret + +// +// Read machine vendor ID +// +ASM_FUNC (RiscVReadMachineVendorId) + csrr a0, RISCV_CSR_MACHINE_MVENDORID + ret + +// +// Read machine architecture ID +// +ASM_FUNC (RiscVReadMachineArchitectureId) + csrr a0, RISCV_CSR_MACHINE_MARCHID + ret + +// +// Read machine implementation ID +// +ASM_FUNC (RiscVReadMachineImplementId) + csrr a0, RISCV_CSR_MACHINE_MIMPID + ret + +// +// Set Supervisor mode scratch. +// @param a0 : Value set to Supervisor mode scratch +// +ASM_FUNC (RiscVSetSupervisorScratch) + csrrw a1, RISCV_CSR_SUPERVISOR_SSCRATCH, a0 + ret + +// +// Get Supervisor mode scratch. +// @retval a0 : Value in Supervisor mode scratch +// +ASM_FUNC (RiscVGetSupervisorScratch) + csrr a0, RISCV_CSR_SUPERVISOR_SSCRATCH + ret + +// +// Set Supervisor mode trap vector. +// @param a0 : Value set to Supervisor mode trap vector +// +ASM_FUNC (RiscVSetSupervisorStvec) + csrrw a1, RISCV_CSR_SUPERVISOR_STVEC, a0 + ret + +// +// Get Supervisor mode scratch. +// @retval a0 : Value in Supervisor mode trap vector +// +ASM_FUNC (RiscVGetSupervisorStvec) + csrr a0, RISCV_CSR_SUPERVISOR_STVEC + ret + +// +// Set Supervisor Address Translation and +// Protection Register. +// +ASM_FUNC (RiscVSetSupervisorAddressTranslationRegister) + csrw RISCV_CSR_SUPERVISOR_SATP, a0 + ret + --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88016): https://edk2.groups.io/g/devel/message/88016 Mute This Topic: https://groups.io/mt/90017682/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88018+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88018+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192616; cv=none; d=zohomail.com; s=zohoarc; b=U16LVRLouYNtILUxoXsMljjSAeHEHOQ4BJCK6rhQhOgG+g+Anh/zQHVaazEZUHAZ5GmgetD8EN03OYxUonhr+O7LJDL8LJXyQu9jEvRBFjg682H61ttPNY9iEO3k0EOXg52VSXTNY4I9SZgnHDCNOW7+oBU6Asb3EbTB4UfeStY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192616; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rDQ1NDd8xhwqNg3hZVLXpWggCKYY3Ytmqq4sUzUuthM=; b=c3f3arMN9VVckNSG/MLIGVng5bjPryAqYbeY7J+/wLpTXPqggeA4wucDI7rt3DHiSgjRb9DkQIzL0fCdkBVTzIKZkmvocSbEjbnWI0LYqf1V1O5m0RrL4yZ9nMBWj9lo5Y8apxhQnbFfjfuzmLqNtUlMLswP9lULkrv04ZFa/Fg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88018+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192615816674.8555097172153; Fri, 25 Mar 2022 00:16:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 091iYY1788612xyjpPlo5ZGm; Fri, 25 Mar 2022 00:16:55 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.2347.1648192614777073305 for ; Fri, 25 Mar 2022 00:16:54 -0700 X-Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P7Esk5011665; Fri, 25 Mar 2022 07:16:52 GMT X-Received: from g9t5008.houston.hpe.com (g9t5008.houston.hpe.com [15.241.48.72]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3f195vr0mj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:52 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5008.houston.hpe.com (Postfix) with ESMTP id 2BED053; Fri, 25 Mar 2022 07:16:51 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id D8F5646; Fri, 25 Mar 2022 07:16:48 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Eric Dong , Ray Ni , Rahul Kumar , Daniel Schaefer , Sunil V L , Andrew Fish , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 4/8] [RFC] UefiCpuPkg/RiscVOpensbLib: Add opensbi submodule Date: Fri, 25 Mar 2022 14:12:45 +0800 Message-Id: <20220325061249.30626-5-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-GUID: 8RWk5upE-pKxoLutQCiW29uNGZqe6Kxi X-Proofpoint-ORIG-GUID: 8RWk5upE-pKxoLutQCiW29uNGZqe6Kxi X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: AHoMeru3v7NHhXl21128cMJbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192615; bh=5znQvVRyBt5PhdJ3j+8KfVgAnXBlO5uBOie7XwA/YPg=; h=Cc:Date:From:Reply-To:Subject:To; b=ZldHUlzkTk2OVVH3h42oDdVL67QGduik2fBwd+anAqVER0mswYba1Yvzm1necPVIq2O 4Eyr8JFDseO38kpiy0bS+8TTwDKPr4yJsZBk1kB1rB9blST0ixKtgvpCXzYelmJi6lp/v bffEfltDdUeCygGTTOpnBX8TmgM1BCSj57M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192617578100001 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 (This is migrated from edk2-platforms:Silicon/RISC-V) Add RISC-V opensbi as the submoudle under UefiCpuPkg/Library/RISC-V Signed-off-by: Abner Chang Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Daniel Schaefer Cc: Sunil V L Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- .gitmodules | 45 ++++++++++--------- .../Library/RISC-V/RiscVOpensbiLib/opensbi | 1 + 2 files changed, 25 insertions(+), 21 deletions(-) create mode 160000 UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi diff --git a/.gitmodules b/.gitmodules index b845c9ee3f..dd68dbfc82 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,22 +1,25 @@ -[submodule "CryptoPkg/Library/OpensslLib/openssl"] - path =3D CryptoPkg/Library/OpensslLib/openssl - url =3D https://github.com/openssl/openssl -[submodule "SoftFloat"] - path =3D ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 - url =3D https://github.com/ucb-bar/berkeley-softfloat-3.git -[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"] - path =3D UnitTestFrameworkPkg/Library/CmockaLib/cmocka - url =3D https://github.com/tianocore/edk2-cmocka.git -[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"] - path =3D MdeModulePkg/Universal/RegularExpressionDxe/oniguruma - url =3D https://github.com/kkos/oniguruma -[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"] - path =3D MdeModulePkg/Library/BrotliCustomDecompressLib/brotli - url =3D https://github.com/google/brotli -[submodule "BaseTools/Source/C/BrotliCompress/brotli"] - path =3D BaseTools/Source/C/BrotliCompress/brotli - url =3D https://github.com/google/brotli +[submodule "CryptoPkg/Library/OpensslLib/openssl"] + path =3D CryptoPkg/Library/OpensslLib/openssl + url =3D https://github.com/openssl/openssl +[submodule "SoftFloat"] + path =3D ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 + url =3D https://github.com/ucb-bar/berkeley-softfloat-3.git +[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"] + path =3D UnitTestFrameworkPkg/Library/CmockaLib/cmocka + url =3D https://github.com/tianocore/edk2-cmocka.git +[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"] + path =3D MdeModulePkg/Universal/RegularExpressionDxe/oniguruma + url =3D https://github.com/kkos/oniguruma +[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"] + path =3D MdeModulePkg/Library/BrotliCustomDecompressLib/brotli + url =3D https://github.com/google/brotli +[submodule "BaseTools/Source/C/BrotliCompress/brotli"] + path =3D BaseTools/Source/C/BrotliCompress/brotli + url =3D https://github.com/google/brotli ignore =3D untracked -[submodule "RedfishPkg/Library/JsonLib/jansson"] - path =3D RedfishPkg/Library/JsonLib/jansson - url =3D https://github.com/akheron/jansson +[submodule "RedfishPkg/Library/JsonLib/jansson"] + path =3D RedfishPkg/Library/JsonLib/jansson + url =3D https://github.com/akheron/jansson +[submodule "UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi"] + path =3D UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi + url =3D https://github.com/riscv-software-src/opensbi diff --git a/UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi b/UefiCpuPkg= /Library/RISC-V/RiscVOpensbiLib/opensbi new file mode 160000 index 0000000000..a731c7e369 --- /dev/null +++ b/UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi @@ -0,0 +1 @@ +Subproject commit a731c7e36988c3308e1978ecde491f2f6182d490 --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88018): https://edk2.groups.io/g/devel/message/88018 Mute This Topic: https://groups.io/mt/90017688/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88017+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88017+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192616; cv=none; d=zohomail.com; s=zohoarc; b=V0ndWKypqscMRHyP6Z7YRrKK/Vo/t4MjZZ95rA3bIRC3yexW7b5B5I+VIbKU1l/75TVs9ZnQRBKwky8itgq+Mm0xTdNslPjOGQtXjt4jdqn/XzUemJQraudNkmXl1YWMDTXTaWxujzqINv9sQXpE5ecAHdWmanPMneq1igZiR3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192616; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=sSrOjNhSKuAg83LQBnOpgH4nmoWruPg+ziB0J9UbQLA=; b=baj2m/0B2EtLaAMKd/zu8hn0aOvLdHf+vKKTNJeO3AKEGDGV9HyHYUCdGH4QHVXD72fP9zkcIy4CN3hUswXSQmmq7l+7ympHDwUXQXLmP6728Fqg6WHoBHT+P+krpx9a5WdhY4k0nxMm5M9Wa2btDT7wQm8pOh3XKS8Kt0V3AAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88017+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 164819261639966.36729295133932; Fri, 25 Mar 2022 00:16:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zrOqYY1788612xmpD7z8RghU; Fri, 25 Mar 2022 00:16:56 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web12.2453.1648192614417752907 for ; Fri, 25 Mar 2022 00:16:54 -0700 X-Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P6R8Ur000646; Fri, 25 Mar 2022 07:16:53 GMT X-Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f18fqrgaa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:53 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 02A7CA1; Fri, 25 Mar 2022 07:16:53 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 751F146; Fri, 25 Mar 2022 07:16:51 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Sunil V L , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 5/8] [RFC] MdePkg/Include: Add RISC-V OpenSBI header files Date: Fri, 25 Mar 2022 14:12:46 +0800 Message-Id: <20220325061249.30626-6-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-GUID: TuEu2Nu9uY2khqa5P9KIm4lIYcG6x9Ul X-Proofpoint-ORIG-GUID: TuEu2Nu9uY2khqa5P9KIm4lIYcG6x9Ul X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: RcndbZydtmyEn2ThXX5hRNFsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192616; bh=8Wtp+OdvFi/gSWSrB6r97VY/td7sv5LOBWpv8YSS53A=; h=Cc:Date:From:Reply-To:Subject:To; b=QYQdbfWfT4ur4jColRlvQXO0hTtwLzPraTgWNroEpoEQDcxjgx8JslnK1dujdDLGKWx n70YmNbqO3T+i5VGu3r4OzVQ6d8Vl3UOXDuqll+v9M/jTZhHW6CMmRnT2PdP5rsfwlA/b lFMc+mGYZ7xS4Fc87JbKrTRQN7yW0PbLF0g= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192617617100002 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 RiscVOpensbiTypes.h: The header file for building RISC-V OpenSBI library. RiscVOpenSBI.h: The header file of using OpenSBI library. Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer M: Liming Gao [lgao4] R: Zhiguang Liu [LiuZhiguang001] Cc: Sunil V L Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- .../Include/IndustryStandard/RiscVOpensbi.h | 62 ++++++++++++++ .../IndustryStandard/RiscVOpensbiTypes.h | 82 +++++++++++++++++++ MdePkg/MdePkg.ci.yaml | 2 + 3 files changed, 146 insertions(+) create mode 100644 MdePkg/Include/IndustryStandard/RiscVOpensbi.h create mode 100644 MdePkg/Include/IndustryStandard/RiscVOpensbiTypes.h diff --git a/MdePkg/Include/IndustryStandard/RiscVOpensbi.h b/MdePkg/Includ= e/IndustryStandard/RiscVOpensbi.h new file mode 100644 index 0000000000..4c9186f212 --- /dev/null +++ b/MdePkg/Include/IndustryStandard/RiscVOpensbi.h @@ -0,0 +1,62 @@ +/** @file + SBI inline function calls. + + Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDK2_RISC_V_SBI_H_ +#define EDK2_RISC_V_SBI_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define RISC_V_MAX_HART_SUPPORTED SBI_HARTMASK_MAX_BITS + +typedef +VOID +(EFIAPI *RISCV_HART_SWITCH_MODE)( + IN UINTN FuncArg0, + IN UINTN FuncArg1, + IN UINTN NextAddr, + IN UINTN NextMode, + IN BOOLEAN NextVirt + ); + +// +// Keep the structure member in 64-bit alignment. +// +typedef struct { + UINT64 IsaExtensionSupported; // The ISA extension th= is core supported. + RISCV_UINT128 MachineVendorId; // Machine vendor ID + RISCV_UINT128 MachineArchId; // Machine Architecture= ID + RISCV_UINT128 MachineImplId; // Machine Implementati= on ID + RISCV_HART_SWITCH_MODE HartSwitchMode; // OpenSBI's function t= o switch the mode of a hart +} EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC; +#define FIRMWARE_CONTEXT_HART_SPECIFIC_SIZE (64 * 8) // This is the size = of EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC + // structure. Referr= ed by both C code and assembly code. + +typedef struct { + UINT64 BootHartId; + VOID *PeiServiceTable; // PEI = Service table + UINT64 FlattenedDeviceTree; // Poin= ter to Flattened Device tree + UINT64 SecPeiHandOffData; // This= is EFI_SEC_PEI_HAND_OFF passed to PEI Core. + EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartSpecific[RISC_V_MAX_HAR= T_SUPPORTED]; +} EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT; + +// +// Typedefs of OpenSBI type to make them conform to EDK2 coding guidelines +// +typedef struct sbi_scratch SBI_SCRATCH; +typedef struct sbi_platform SBI_PLATFORM; + +#endif diff --git a/MdePkg/Include/IndustryStandard/RiscVOpensbiTypes.h b/MdePkg/I= nclude/IndustryStandard/RiscVOpensbiTypes.h new file mode 100644 index 0000000000..6a6a1f532d --- /dev/null +++ b/MdePkg/Include/IndustryStandard/RiscVOpensbiTypes.h @@ -0,0 +1,82 @@ +/** @file + RISC-V OpenSBI header file reference. + + Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDK2_RISC_V_SBI_TYPES_H_ +#define EDK2_RISC_V_SBI_TYPES_H_ + +#include + +typedef INT8 s8; +typedef UINT8 u8; +typedef UINT8 uint8_t; + +typedef INT16 s16; +typedef UINT16 u16; +typedef INT16 int16_t; +typedef UINT16 uint16_t; + +typedef INT32 s32; +typedef UINT32 u32; +typedef INT32 int32_t; +typedef UINT32 uint32_t; + +typedef INT64 s64; +typedef UINT64 u64; +typedef INT64 int64_t; +typedef UINT64 uint64_t; + +// PRILX is not used in EDK2 but we need to define it here because when +// defining our own types, this constant is not defined but used by OpenSB= I. +#define PRILX "016lx" + +typedef BOOLEAN bool; +typedef unsigned long ulong; +typedef UINT64 uintptr_t; +typedef UINT64 size_t; +typedef INT64 ssize_t; +typedef UINT64 virtual_addr_t; +typedef UINT64 virtual_size_t; +typedef UINT64 physical_addr_t; +typedef UINT64 physical_size_t; + +#define true TRUE +#define false FALSE + +#define __packed __attribute__((packed)) +#define __noreturn __attribute__((noreturn)) +#define __aligned(x) __attribute__((aligned(x))) + +#if defined (__GNUC__) || defined (__clang__) +#define likely(x) __builtin_expect((x), 1) +#define unlikely(x) __builtin_expect((x), 0) +#else +#define likely(x) (x) +#define unlikely(x) (x) +#endif + +#undef offsetof +#ifdef __compiler_offsetof +#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE,MEMBER) +#else +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + +#define container_of(ptr, type, member) ({ \ + const typeof(((type *)0)->member) * __mptr =3D (ptr); \ + (type *)((char *)__mptr - offsetof(type, member)); }) + +#define array_size(x) (sizeof(x) / sizeof((x)[0])) + +#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi) +#define ROUNDUP(a, b) ((((a)-1) / (b) + 1) * (b)) +#define ROUNDDOWN(a, b) ((a) / (b) * (b)) + +/* clang-format on */ + +#endif diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml index 054233ebc7..7c05fb913f 100644 --- a/MdePkg/MdePkg.ci.yaml +++ b/MdePkg/MdePkg.ci.yaml @@ -50,6 +50,8 @@ "Include/IndustryStandard/Tpm20.h", "Include/IndustryStandard/IoRemappingTable.h", "Include/IndustryStandard/UefiTcgPlatform.h", + "Include/IndustryStandard/RiscVOpensbi.h", + "Include/IndustryStandard/RiscVOpensbiTypes.h", "Include/Library/PcdLib.h", "Include/Library/SafeIntLib.h", "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c" --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88017): https://edk2.groups.io/g/devel/message/88017 Mute This Topic: https://groups.io/mt/90017687/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88020+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88020+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192623; cv=none; d=zohomail.com; s=zohoarc; b=O2KhP1l9wWXZYg6twN2WquIecktXziK9g/L2LXxRcYaWCnh5NIgwCr0K8Qws/XRkMh6txrzxsApmIWeo3XAY7ahNVbxGj4ZJGaIFNF8DC2bxCqkplS9C9tDMYy+eOEvXsUrWaKOGC7fNzFEa68tAUXshRKJrdOTeo069gaD/uhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192623; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gS2Us4mhDVydMDIHISDiPXtvyLC+gSIzT0NcY+SDH44=; b=MpUGY0PZP2dIJy4kQNSWODUkd9eKQgn9EYDngaglzodAz9UhIkQY7kTC+LDm0eRu0JsjqYA0Hn7AFz3znlj7JO1iEM8epN5K9H2r4QP6yReJLuzuaClvgGZ+2ecrmi4QNmGTwfkAxMfp3ObCkXP3nMC32iwbPv0GnXUzMGjXo8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88020+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192623844295.40647858717125; Fri, 25 Mar 2022 00:17:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id C4LxYY1788612x92dQ1qgHT0; Fri, 25 Mar 2022 00:17:03 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web12.2455.1648192622882084987 for ; Fri, 25 Mar 2022 00:17:02 -0700 X-Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P7Edvq016103; Fri, 25 Mar 2022 07:16:56 GMT X-Received: from g9t5008.houston.hpe.com (g9t5008.houston.hpe.com [15.241.48.72]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f195y80qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:56 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5008.houston.hpe.com (Postfix) with ESMTP id 4AA0053; Fri, 25 Mar 2022 07:16:55 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 51B0F46; Fri, 25 Mar 2022 07:16:53 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Sunil V L , Leif Lindholm , Michael D Kinney , Bob Feng , Liming Gao , Yuwei Chen Subject: [edk2-devel] [PATCH V2 6/8] [RFC] BaseTools/Conf: Relocate RiscVOpensbiTypes.h Date: Fri, 25 Mar 2022 14:12:47 +0800 Message-Id: <20220325061249.30626-7-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: WRtG34b2CYq6HinJHXEY2CQieNxC_3j2 X-Proofpoint-ORIG-GUID: WRtG34b2CYq6HinJHXEY2CQieNxC_3j2 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: X7lZUsUOMZW6SkMcBqH4KAKjx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192623; bh=xrUeHSBj/mY7xgP0N1dObtdoRNkn4U4YklMPkAygR5E=; h=Cc:Date:From:Reply-To:Subject:To; b=pSA+lG8Otue+tqSlrzGIUnEKPT6NQ2kTXYxN1O3hOlx27OiNoFQnEk0pGUHLYWzjeoL wFuaEXF6LTFa9qnX1zDYbG0laB8dQdLUEcwhxdhh3/wGzj+q6JRb/pR7IcQiyWk4tM2Wi LS54jfNnMUQUOTw8tJlhMlo0j07URwIIIV8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192625141100009 Content-Type: text/plain; charset="utf-8" Relocation of RiscVOpensbiTypes.h, which is under: MdePkg/Include/IndustryStandard/ Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer Cc: Sunil V L Cc: Leif Lindholm Cc: Michael D Kinney Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 9c310cf23d..c1eea33e71 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1978,7 +1978,7 @@ DEFINE GCC5_RISCV_ALL_DLINK2_FLAGS =3D= -Wl,--defsym=3DPECOFF_HEADER_S DEFINE GCC5_RISCV_ALL_ASM_FLAGS =3D -c -x assembler -ima= cros $(DEST_DIR_DEBUG)/AutoGen.h DEFINE GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE =3D -Wno-tautological-co= mpare -Wno-pointer-compare =20 -DEFINE GCC5_RISCV_OPENSBI_TYPES =3D -DOPENSBI_EXTERNAL_S= BI_TYPES=3DOpensbiTypes.h +DEFINE GCC5_RISCV_OPENSBI_TYPES =3D -DOPENSBI_EXTERNAL_S= BI_TYPES=3DIndustryStandard/RiscVOpensbiTypes.h =20 DEFINE GCC5_RISCV64_ARCH =3D rv64imafdc DEFINE GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS =3D DEF(GCC5_RISCV_ALL_DLINK_CO= MMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88020): https://edk2.groups.io/g/devel/message/88020 Mute This Topic: https://groups.io/mt/90017691/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88019+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88019+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192620; cv=none; d=zohomail.com; s=zohoarc; b=Gc6ApDl8aRLy9KDCptSUN6qP+iXEt306y0DdE2X7JQCD8XsxvwGmye9PwBbz6QQ8ZafL22IJYcY9wOhB3AR9F+v7WgVsjDqKKctP6fOfC+YBHXCcIargLG8GD/UKd0TamYqM/yHYUdEE/CJgVI1oqnYhYmmh/oXLMwE4ndWOB3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192620; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=JwXttS1GlLGoa8lydDklu/oZDNzCAuhnn2TcUZdPIFA=; b=Vc59Kjf9whtJW5vj4YyBo2MJVuXzx/8NWeLhMFh5nY3KRz5yZtumoAQiEUV/sSpFwu5+owMj27Cy1CPRVKo/8HWaAFrdkL5FzEc7MucxEfF2mf8edSyhZwTIh8tIWSitjafklDKZAWZnsbYAJwR2GmZL44KSXbVqKEQnRnI9qlI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88019+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648192620226702.3765112670098; Fri, 25 Mar 2022 00:17:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id a3VMYY1788612xPT7dIbrqFI; Fri, 25 Mar 2022 00:16:59 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.2326.1648192619055821877 for ; Fri, 25 Mar 2022 00:16:59 -0700 X-Received: from pps.filterd (m0134423.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P5ub4E000921; Fri, 25 Mar 2022 07:16:58 GMT X-Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f1164bhwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:16:58 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 8E4078D; Fri, 25 Mar 2022 07:16:57 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 81E9B54; Fri, 25 Mar 2022 07:16:55 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Eric Dong , Ray Ni , Rahul Kumar , Sunil V L , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 7/8] [RFC] UefiCpuPkg/Library: Add RiscVOpensbiLib Date: Fri, 25 Mar 2022 14:12:48 +0800 Message-Id: <20220325061249.30626-8-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: ODopSPwOmEd7Ud7Y88N4-COfwzj20MLZ X-Proofpoint-GUID: ODopSPwOmEd7Ud7Y88N4-COfwzj20MLZ X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: obbLfnEDQ7ATCwJE81EPMzSZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192619; bh=JTa4mDBoIWSvgzo4mXd/GTj0lvxhcB3DrjC+la7GY48=; h=Cc:Date:From:Reply-To:Subject:To; b=K0jliCMoCmnnIv1H0d9kJWI62jmHsEMtuVKt0Yf+QCDZM64JaRhcKJxGwKztmjpRcK/ 83U5QWEK0CZWnT3Q3T3iyS4DQLoCrVu25wlETfvDj2XxQ2hBKSLP9xYHzZAUHhMWzkZZe Ay+VbtU5GSjk3ZkS6SEStQObgFUd3N73J1o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192621169100001 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 (This is migrated from edk2-platforms:Silicon/RISC-V) EDK2 RISC-V OpenSBI library which pull in external source files under UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi to the build process. Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Sunil V L Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- UefiCpuPkg/UefiCpuPkg.dec | 9 +- UefiCpuPkg/UefiCpuPkg.dsc | 6 ++ .../RiscVOpensbiLib/RiscVOpensbiLib.inf | 89 +++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiL= ib.inf diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 613881368b..f7e7142882 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -15,9 +15,16 @@ PACKAGE_GUID =3D 2171df9b-0d39-45aa-ac37-2de190010d23 PACKAGE_VERSION =3D 0.90 =20 -[Includes] +[Includes.common] Include =20 +[Includes.RISCV64] + Include/Library + Library/RISC-V/RiscVOpensbiLib/opensbi # OpenSBI header file ref= erence ("include/sbi/...") + Library/RISC-V/RiscVOpensbiLib/opensbi/include # Header file reference f= rom opensbi files, ("sbi/...") + Library/RISC-V/RiscVOpensbiLib/opensbi/platform/generic/include # Header= file reference from opensbi files, ("sbi/...") + + [LibraryClasses] ## @libraryclass Defines some routines that are used to register/manag= e/program ## CPU features. diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 50c9fc294c..374e951f29 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -66,6 +66,9 @@ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 +[LibraryClasses.RISCV64] + RiscVOpensbiLib|UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLi= b.inf + [LibraryClasses.common.SEC] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf @@ -185,5 +188,8 @@ UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf =20 +[Components.RISCV64] + UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLib.inf + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLib.inf = b/UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLib.inf new file mode 100644 index 0000000000..54eed050d4 --- /dev/null +++ b/UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLib.inf @@ -0,0 +1,89 @@ +## @file +# RISC-V Opensbi Library Instance. +# +# Copyright (c) 2022, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001b + BASE_NAME =3D RiscVOpensbiLib + FILE_GUID =3D 6EF0C812-66F6-11E9-93CE-3F5D5F0DF0A7 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RiscVOpensbiLib + +[Sources] + opensbi/lib/sbi/riscv_asm.c + opensbi/lib/sbi/riscv_atomic.c + opensbi/lib/sbi/riscv_hardfp.S + opensbi/lib/sbi/riscv_locks.c + opensbi/lib/sbi/sbi_bitmap.c + opensbi/lib/sbi/sbi_bitops.c + opensbi/lib/sbi/sbi_console.c + opensbi/lib/sbi/sbi_domain.c + opensbi/lib/sbi/sbi_ecall.c + opensbi/lib/sbi/sbi_ecall_base.c + opensbi/lib/sbi/sbi_ecall_hsm.c + opensbi/lib/sbi/sbi_ecall_legacy.c + opensbi/lib/sbi/sbi_ecall_replace.c + opensbi/lib/sbi/sbi_ecall_vendor.c + opensbi/lib/sbi/sbi_emulate_csr.c + opensbi/lib/sbi/sbi_fifo.c + opensbi/lib/sbi/sbi_hart.c + opensbi/lib/sbi/sbi_math.c + opensbi/lib/sbi/sbi_hfence.S + opensbi/lib/sbi/sbi_hsm.c + opensbi/lib/sbi/sbi_illegal_insn.c + opensbi/lib/sbi/sbi_init.c + opensbi/lib/sbi/sbi_ipi.c + opensbi/lib/sbi/sbi_misaligned_ldst.c + opensbi/lib/sbi/sbi_platform.c + opensbi/lib/sbi/sbi_scratch.c + opensbi/lib/sbi/sbi_string.c + opensbi/lib/sbi/sbi_system.c + opensbi/lib/sbi/sbi_timer.c + opensbi/lib/sbi/sbi_tlb.c + opensbi/lib/sbi/sbi_trap.c + opensbi/lib/sbi/sbi_unpriv.c + opensbi/lib/sbi/sbi_expected_trap.S + + opensbi/lib/utils/fdt/fdt_helper.c + opensbi/lib/utils/fdt/fdt_fixup.c + opensbi/lib/utils/fdt/fdt_domain.c + opensbi/lib/utils/ipi/fdt_ipi.c + opensbi/lib/utils/ipi/aclint_mswi.c + opensbi/lib/utils/ipi/fdt_ipi_mswi.c + opensbi/lib/utils/irqchip/fdt_irqchip.c + opensbi/lib/utils/irqchip/fdt_irqchip_plic.c + opensbi/lib/utils/irqchip/plic.c + opensbi/lib/utils/reset/fdt_reset.c + opensbi/lib/utils/reset/fdt_reset_htif.c + opensbi/lib/utils/reset/fdt_reset_sifive.c + opensbi/lib/utils/reset/fdt_reset_thead.c + opensbi/lib/utils/reset/fdt_reset_thead_asm.S + opensbi/lib/utils/serial/fdt_serial.c + opensbi/lib/utils/serial/fdt_serial_htif.c + opensbi/lib/utils/serial/fdt_serial_shakti.c + opensbi/lib/utils/serial/fdt_serial_sifive.c + opensbi/lib/utils/serial/fdt_serial_uart8250.c + opensbi/lib/utils/serial/fdt_serial_gaisler.c + opensbi/lib/utils/serial/gaisler-uart.c + opensbi/lib/utils/serial/shakti-uart.c + opensbi/lib/utils/serial/sifive-uart.c + opensbi/lib/utils/serial/uart8250.c + opensbi/lib/utils/sys/htif.c + opensbi/lib/utils/sys/sifive_test.c + opensbi/lib/utils/timer/fdt_timer.c + opensbi/lib/utils/timer/aclint_mtimer.c + opensbi/lib/utils/timer/fdt_timer_mtimer.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec # For libfdt. + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[BuildOptions] + GCC:*_*_*_PP_FLAGS =3D -D__ASSEMBLY__ --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88019): https://edk2.groups.io/g/devel/message/88019 Mute This Topic: https://groups.io/mt/90017690/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 16:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88021+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88021+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1648192624; cv=none; d=zohomail.com; s=zohoarc; b=AnbWOWfdLpgn+IU7hL4HUIlt9LRpvzoSabt1BiMfIeCe5FVsY2C5BzABmcez3UeiuW+k1433CaYtlAW1MZktZAvSC/cLuB/mbj8NTz9RyTi19BRR+Oh+yycTBwaMHjWkZlqZvsyqe+pYI8WZ2NlhKt+U67VHCX51RZIQ3QzVo7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648192624; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=CB0JSMJemr5IQthBldYQkrbWTv+abaszGl4TTwIQGYQ=; b=bqh8kMb8uXrnbEgp1JWh6Hw2i64zo5/+luhhtswir3CBqjHpqexl61666zuVtNBhVihh26+IRrMFdTU47K8RtFaHwL6zk/xLOu5AnvQhmNNEAnQ2g2wh+K3YVt8kPV7XanTCfN+SGFNglb6cVrqF+0DhQZpvjrM6HMKCtSpox9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88021+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 164819262456750.19892219207043; Fri, 25 Mar 2022 00:17:04 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Od4xYY1788612xHaUX48ndfj; Fri, 25 Mar 2022 00:17:04 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web10.2350.1648192622996122276 for ; Fri, 25 Mar 2022 00:17:03 -0700 X-Received: from pps.filterd (m0134423.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P5umej001530; Fri, 25 Mar 2022 07:17:00 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3f1164bhwu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 07:17:00 +0000 X-Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id 1AE6867; Fri, 25 Mar 2022 07:17:00 +0000 (UTC) X-Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id DBBAC4C; Fri, 25 Mar 2022 07:16:57 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Daniel Schaefer , Eric Dong , Ray Ni , Rahul Kumar , Sunil V L , Andrew Fish , Leif Lindholm , Michael D Kinney , Chao Li Subject: [edk2-devel] [PATCH V2 8/8] [RFC] UefiCpuPkg: Update YAML file for RISC-V arch Date: Fri, 25 Mar 2022 14:12:49 +0800 Message-Id: <20220325061249.30626-9-abner.chang@hpe.com> In-Reply-To: <20220325061249.30626-1-abner.chang@hpe.com> References: <20220325061249.30626-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: UYkPOYfNNJ7ZE8QCi5wJnC2hxczeDdlX X-Proofpoint-GUID: UYkPOYfNNJ7ZE8QCi5wJnC2hxczeDdlX X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: 8Jxv9cw7bCdVpYmJ1ZU7N9Dcx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648192624; bh=zWqExYCNVuB/z3a5pa0VuuBM+rAt9MHxsB1FdpL8Tok=; h=Cc:Date:From:Reply-To:Subject:To; b=Hy1kwDvxwQyJGoAGzALdLtTJKjaJrVrjU/GXMKNJTDJRNT2ttqeurUIValXxnZjxW3O vwpcSEXPMMoJzAP3vyZFVV6o12RNK9PC/exwo5qOt7oP3rv2FwzqE5HatE64uEWdoGqN0 qWdcdbEu0ImrVYabSAv1w+zOBoAmfmTOmXQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648192625151100010 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3860 Signed-off-by: Abner Chang Co-authored-by: Daniel Schaefer Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Sunil V L Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Chao Li --- UefiCpuPkg/UefiCpuPkg.ci.yaml | 60 +++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/UefiCpuPkg.ci.yaml b/UefiCpuPkg/UefiCpuPkg.ci.yaml index 6e0ab95fd8..3ac249bb46 100644 --- a/UefiCpuPkg/UefiCpuPkg.ci.yaml +++ b/UefiCpuPkg/UefiCpuPkg.ci.yaml @@ -3,6 +3,7 @@ # # Copyright (c) Microsoft Corporation # Copyright (c) 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2022 Hewlett Packard Enterprise Development LP. All rights= reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## { @@ -18,6 +19,10 @@ ], ## Both file path and directory path are accepted. "IgnoreFiles": [ + ## Below source files incorporate with open source + ## RISC-V OpenSBI project, in which some coding style is + ## not able to pass the ECC. + "Library/RISC-V/RiscVOpensbiLib/opensbi" ] }, "CompilerPlugin": { @@ -69,8 +74,59 @@ ## options defined ci/Plugin/SpellCheck "SpellCheck": { "AuditOnly": True, # Fails test but run in AuditOnly mod= e to collect log - "IgnoreFiles": [], # use gitignore syntax to ignore erro= rs in matching files - "ExtendWords": [], # words to extend to the dictionary f= or this package + "IgnoreFiles": [ # use gitignore syntax to ignore erro= rs in matching files + "Library/RISC-V/RiscVOpensbiLib/opensbi/**" + ], + "ExtendWords": [ # words to extend to the dictionary fo= r this package + "aclint", + "dmdepkg", + "ecall", + "ecalls", + "efifstub", + "excep", + "execption", + "gaisler", + "hardfp", + "hfence", + "htimehw", + "htimew", + "impid", + "irqchip", + "keepexceptiontable", + "libfdt", + "mbase", + "mbound", + "mcause", + "mdbase", + "mdbound", + "memeory", + "mfromhost", + "mhartid", + "mibase", + "mibound", + "mideleg", + "mscratch", + "mstatus", + "mtimeh", + "mtimer", + "mtohost", + "mtvec", + "mvendorid", + "opensbi", + "prilx", + "rfence", + "scasue", + "scause", + "sfence", + "sifive", + "smode", + "sramt", + "sscratch", + "sstatus", + "stval", + "stvec", + "transational" + ], "IgnoreStandardPaths": [], # Standard Plugin defined paths that = should be ignore "AdditionalIncludePaths": [] # Additional paths to spell check (wi= ldcards supported) } --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88021): https://edk2.groups.io/g/devel/message/88021 Mute This Topic: https://groups.io/mt/90017692/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-