From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mx.groups.io with SMTP id smtpd.web11.19127.1681498716562035141 for ; Fri, 14 Apr 2023 11:58:36 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@ventanamicro.com header.s=google header.b=YV6kEgEp; spf=pass (domain: ventanamicro.com, ip: 209.85.216.49, mailfrom: tphan@ventanamicro.com) Received: by mail-pj1-f49.google.com with SMTP id pm7-20020a17090b3c4700b00246f00dace2so11722416pjb.2 for ; Fri, 14 Apr 2023 11:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1681498715; x=1684090715; 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=YV6kEgEp16XpVhvTFr6/G6gGyeR1FPdIVvv1RQhd5/yXSqXzOew9tdoYPFyIpbskLw LQqkXgeWwNcM7W8z3D92jWDilxNgNok1LAekcOxI3cN8DOjf+6vxDyzCmdVriogM8rYc 1do0HSlEXj7KxkWSyKa3sU8aOTYVWbAWBDSSGalcs2EdHC578Tq1Ndu2s/H5YYIkoIhV 5CxmfcVjn+qbS4AFBHx2SFboGKpV+F18Tf0WVoJkn/Wch+vEI14JUvXoJZqQKiGgfsMH 3uKCMifcc0HcHG1Ywl80CenZis5+RM/GxUu3niZ3LWr3ZXsDjP4I4DF3eKcij1otKasj 2ccA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681498715; x=1684090715; 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=Fz0m1idS7YA+rKunxDWhN5W9oDkyeNnHJQgQ5wKq8rNwQNzUhrRwpmNZ9ZN3yyqe2N gTEzXWSU8ANJaYPxNsNEdCTQC5SF1tOYvmwsf0HNSQ109F/0QffwlogT0OW9kQgcN2gT t4m0yBQe0mWKReTJGosIH/nevLANNl/V/tMzOkvN3zuVHyc+MX0HNIx5v1djiyslRVex Zq/8+i/OwWUzaj2Gbjt/Fxp0cCb6iIGyasRXRxQFwx9147G9gf6PGXibv7qEWMVD+ErS Ha+KOaVkKZY+r3dCHsubRvFUnE9an1Tzh8Hi8lIuxuq8eK8Mj36SQ+YskU/QjMg+7/Zw mdxg== X-Gm-Message-State: AAQBX9cnqa/nRCFIMH8Ol4Mp0yQx0TcDkMFK3+aeiDxGIOMssl0DxyZY JwoKW0GfnKrlbCJvm70f3sIZDUq4vyX9RZY/uMSS7Q== X-Google-Smtp-Source: AKy350aiTD8qICl6M+L7ydXUvl4JFcfJt0ol2RF+rqKKHmG+2muo+rhjr7gLzelgu/d6Y5pYZCdNuA== X-Received: by 2002:a17:902:d482:b0:1a4:fae1:d6b0 with SMTP id c2-20020a170902d48200b001a4fae1d6b0mr4987922plg.28.1681498715626; Fri, 14 Apr 2023 11:58:35 -0700 (PDT) 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 g20-20020a170902869400b001a681d123a0sm3329760plo.297.2023.04.14.11.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 11:58:35 -0700 (PDT) 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 v2 1/6] MdePkg/BaseLib: RISC-V: Support getting satp register value Date: Fri, 14 Apr 2023 11:58:10 -0700 Message-Id: <20230414185815.2994-2-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414185815.2994-1-tphan@ventanamicro.com> References: <20230414185815.2994-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