From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mx.groups.io with SMTP id smtpd.web10.1077.1678124007835288108 for ; Mon, 06 Mar 2023 09:33:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=j9UXK9E0; spf=pass (domain: ventanamicro.com, ip: 209.85.210.177, mailfrom: tphan@ventanamicro.com) Received: by mail-pf1-f177.google.com with SMTP id cp12so6337267pfb.5 for ; Mon, 06 Mar 2023 09:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1678124007; 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=9f6KuoxV4+kgdeHlFIDpurquBUuDnn1GJOkJh20gtu8=; b=j9UXK9E0j0hnfLAdhUOOegUv9+iZYTUZAS9WWY7a/jDzrUEjIiKueBy3wCwmMYu2Og CFQM6Mu7m55nbquwBN1wfNAKWLF8iT+yKzWEmmLAl+ao7GFG3YoXFe+VOSDNes2S0pkE i7wZOivWV8HBEGAd45Ca7CYU6VgH5YORRvc3O6sSFENlS8tgjiKL6/YLGlH5JPiI5dOT /nLSKgdVm8y8sx8Ebo2LTLJvvEr/pOlZTJoNsRxpwkCLB/tErorEgEv0IrQVnrvFfX4S j6Jd2kvmsqZVY96TF/B3FnuCIOLnefCjOt3GuIeTuEChVLjNLo1QU6LhX32ya+kIaVrO Pmiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678124007; 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=9f6KuoxV4+kgdeHlFIDpurquBUuDnn1GJOkJh20gtu8=; b=YrflRg6y6qeuOBHnd0+JZtlUv66KI4c6V0POdzrOujGQ+kQdq7O3eflt2y+fBSyuv6 FDZYO1bVJLahG8N1f5CiCpXgx7zC/sb+EHK/a8dmiQ0VtyITduArLfmXDlsuhTs+4Jzx mOAvlOBcg+3VhDYEzDPI1Em/euJ007fytFVx9hVGw+gXplx9xSfOb8jX9Fy+JLFnb0Qd pcMNcMpnEQkx+PWLckTwWDa1m2J0/MzFgcMmFcjPXyhHwHr9tjc4S/CJAJMlxcsTReBT lglY8U9ZPNLdh2aooD8GJF0tKNAEJ5RGyjWfxSrFhqRT3D9V0G0j6tMCC/PDW3G0psQy bIUQ== X-Gm-Message-State: AO0yUKW418EfPGPlwdqRTShQCi2nKzSJTp72rdb1KWhZsnNo3xI068In px2oZWtRyVcu3/EAOv5i4WdpLGwZQ8hYQ6R8UVQejw== X-Google-Smtp-Source: AK7set+HFkI72Ysok/kul+miG8KZT6f+BBeQ2g7Ick8tzbCpt1iPkkyeNuFubb4MIVDsZf/aP5ZcYw== X-Received: by 2002:a62:6416:0:b0:593:ebc7:a6d2 with SMTP id y22-20020a626416000000b00593ebc7a6d2mr11743617pfb.21.1678124006923; Mon, 06 Mar 2023 09:33:26 -0800 (PST) Return-Path: Received: from localhost.localdomain (c-174-50-177-95.hsd1.ca.comcast.net. [174.50.177.95]) by smtp.gmail.com with ESMTPSA id v6-20020aa78506000000b005dd975176c3sm6579722pfn.53.2023.03.06.09.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 09:33:26 -0800 (PST) From: "Tuan Phan" To: devel@edk2.groups.io Cc: michael.d.kinney@intel.com, gaoliming@byosoft.com.cn, zhiguang.liu@intel.com, sunilvl@ventanamicro.com, git@danielschaefer.me, andrei.warkentin@intel.com, Tuan Phan Subject: [PATCH 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value Date: Mon, 6 Mar 2023 09:33:10 -0800 Message-Id: <20230306173316.10319-2-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230306173316.10319-1-tphan@ventanamicro.com> References: <20230306173316.10319-1-tphan@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add an API to retrieve satp register value. Signed-off-by: Tuan Phan --- MdePkg/Include/Library/BaseLib.h | 5 +++++ MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/Base= Lib.h index 8f2df76c29a3..5d7067ee854e 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -181,6 +181,11 @@ RiscVSetSupervisorAddressTranslationRegister ( IN UINT64=0D );=0D =0D +UINT64=0D +RiscVGetSupervisorAddressTranslationRegister (=0D + VOID=0D + );=0D +=0D UINT64=0D RiscVReadTimer (=0D VOID=0D diff --git a/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S b/MdePkg/Library/Bas= eLib/RiscV64/RiscVMmu.S index ac8f92f38aed..c9cf60c1664b 100644 --- a/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S +++ b/MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S @@ -21,3 +21,11 @@ ASM_FUNC (RiscVSetSupervisorAddressTranslationRegister)=0D csrw CSR_SATP, a0=0D ret=0D +=0D +//=0D +// Get the value of Supervisor Address Translation and=0D +// Protection Register.=0D +//=0D +ASM_FUNC (RiscVGetSupervisorAddressTranslationRegister)=0D + csrr a0, CSR_SATP=0D + ret=0D --=20 2.25.1