From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mx.groups.io with SMTP id smtpd.web10.6042.1687545669519241004 for ; Fri, 23 Jun 2023 11:41:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@ventanamicro.com header.s=google header.b=gBYSt4cs; spf=pass (domain: ventanamicro.com, ip: 209.85.210.176, mailfrom: tphan@ventanamicro.com) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6686708c986so775933b3a.0 for ; Fri, 23 Jun 2023 11:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1687545668; x=1690137668; 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=H9FGIuvcRPJ9J8Dfn2DKqgwPPfU/GTbbAOcnVe82FYE=; b=gBYSt4cscVcjTzpsr58iIiPVFoOn/qh9iSSSOv2/YQZZpyf6ZMJCJJpKm600jAEUXz F8qaCNXKGrQiLfXpsLe6KsynLHEaZ0M8Qdk6CjhC2vJnQbcgl9ttKIN6N38Wl+okTZe6 HTD7HDPUZc9R84c4aEl/MowlyHc6xs02rudRnSaT6JgvRVD0k+Q51E/rlmWP4OyD09Fh 2ASuP40LadRDnXUGjwaY27BHj1R/o2rgoyWCF1V0MM9nDZxVHShgJjTGwG6sEfr2dIVu udKVdWktpZzgkV7IfvfAG+nS7n1W44BLgXcQ40PnHuTJr8n8iv/RmP87PTc4ixs3+Has WCzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687545668; x=1690137668; 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=H9FGIuvcRPJ9J8Dfn2DKqgwPPfU/GTbbAOcnVe82FYE=; b=MggsO7k7NFs05PfjJi5mtgVxBHPk2nnRyudE1lbilfHV8yOUVFN1gbFqGWS2PN5q3R avQbXxmQ+2PSWUVlpNTqhnHl1f/6H7rtX/lO2H05n39/TVWwDafH8ptYu1Q0Qs3QhhRA /eKCAt46LSRxYeEcaUN2l+8P3Gk81/k3tT4wG0OhoQ1K30Hn1/rREi46rQ3P0r+M0CTF 8eh/1u3RBwwG0XXxEBIPmoG7Zv3Fw7clV7iadRJmUrkrW89+O8egY2JY0LoLchbRGfyx P6UR/6J3eHotMiwJQyzTjddiIRCtriQu8h9bLGQsiPOXzh1IqPEneF9EDV2ISZ4qFb8c tgow== X-Gm-Message-State: AC+VfDzyFQBkMY4CD4vNPsZ3bVGQQNPdI5Zw1XPTCzDcNzl2DfokuHoo IlmQNbAR4mP30jgEXULDhRT+2neqLU2rodYeQFlGSQ== X-Google-Smtp-Source: ACHHUZ4g9WbXhgBfptpagCkSfN6b8y0m6h1D8evRRk5fwuMuF6el8leQ0cjaeP5uMgZCai5nisyZTg== X-Received: by 2002:a05:6a20:748d:b0:10c:89cc:bc5f with SMTP id p13-20020a056a20748d00b0010c89ccbc5fmr26399384pzd.20.1687545668571; Fri, 23 Jun 2023 11:41:08 -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 v2-20020aa78502000000b006667b36e904sm6354184pfn.113.2023.06.23.11.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 11:41:08 -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, ardb+tianocore@kernel.org, Tuan Phan Subject: [PATCH v4 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value Date: Fri, 23 Jun 2023 11:39:28 -0700 Message-Id: <20230623183934.23905-2-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230623183934.23905-1-tphan@ventanamicro.com> References: <20230623183934.23905-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 Reviewed-by: Andrei Warkentin Reviewed-by: Sunil V L --- 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