From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mx.groups.io with SMTP id smtpd.web10.3783.1689361726019792497 for ; Fri, 14 Jul 2023 12:08:46 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@ventanamicro.com header.s=google header.b=N0nHhYbY; spf=pass (domain: ventanamicro.com, ip: 209.85.214.171, mailfrom: tphan@ventanamicro.com) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1b9c368f4b5so23301335ad.0 for ; Fri, 14 Jul 2023 12:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689361725; x=1691953725; 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=N0nHhYbYDSp/HQK99I/TtNPi/Mz8VscRww7sfPJyQROP62385AjS0+NGQKAJ7hrv50 vJUGP61EBzHGoGK5Fi+XbjYJnmN54F4ATTqO0t1+v6MJPsrLICQYb7PSovqqcwb6y21e ZLOqrgS5IsXvfo7ATmdKWqWjwEGpMMcut/dB2QRGTIIUbjG8gbpNdM6wvj3vX7lJe97G CxGk43EyWF5oEUzDmRa0kSrUNIcxDZh1lUwpQC7bHCZ33HCf+jWcETPCL27SJguTVpmi mJg/0JdIRuY6gRcpkZOsjG8qi2vM8s/uEMb7zez7Cf0zmUgxABsKS3FC0xm4N/kfb5o6 mH9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689361725; x=1691953725; 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=BK1elSvGU9owJrLsButcAINw8bVSTDcUD9uucp/erNNdxI6Xh4C1L978VF/+j7H2NV Prjkif76hKZOHp+B/K/59AehsDNuK6uFaUHOEYUDhWoZG5THsW9Sypmk6lFRBzynqYI5 8f3hImHVHqy5OH/TReSThoV3BnaQZGzgXJ9ynzHNakUEmhw0PSMa3an0xlPl6BGnxATt /wplLZYSenxVejfeCndZXEFh0LzcclnqVQp+MEbG+SMx5oW4YeD/uiQ8GEXDkG/xdoJD 3C9/lGAWbP/AVSgiWOaao/g5fd/BcwpjHXa/wvMGFQpB1tHeAb/nvS96TtNonaGdMYL9 +xEA== X-Gm-Message-State: ABy/qLaTNqS4oBFiJGJIJM3J2rnl+G5df3/XF7aEP2ZlO2x5eXARNGhG 6oYdac2oZPsfBMBNyKoBFXi0ZQQDOELGbpwLN9ixrg== X-Google-Smtp-Source: APBJJlHYjiKVwZnVLXAwvxiLSU7uyOxoL6d9TBaUvs7/r8mQLlP8MOOj78iAL/cjXBzNYJSUaSKFIw== X-Received: by 2002:a17:902:d502:b0:1b8:865e:44e7 with SMTP id b2-20020a170902d50200b001b8865e44e7mr4583481plg.20.1689361725039; Fri, 14 Jul 2023 12:08:45 -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 p18-20020a170902ead200b001a98f844e60sm8041413pld.263.2023.07.14.12.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jul 2023 12:08:44 -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 v5 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value Date: Fri, 14 Jul 2023 12:08:18 -0700 Message-Id: <20230714190824.16552-2-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230714190824.16552-1-tphan@ventanamicro.com> References: <20230714190824.16552-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