From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mx.groups.io with SMTP id smtpd.web11.1174.1685143061727830684 for ; Fri, 26 May 2023 16:17:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=G+LadyQN; spf=pass (domain: ventanamicro.com, ip: 209.85.210.169, mailfrom: tphan@ventanamicro.com) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-64f47448aeaso1136036b3a.0 for ; Fri, 26 May 2023 16:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1685143061; x=1687735061; 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=A40S6Bry9WykyoYURiCxbPIMG/3ZQ73ed4B6XGO0wYM=; b=G+LadyQN9DUCSrUvd0bRYST5P+4fK0sAGgWzTcU89hBxFmnFWNmPu0U7dwr22ZQFBn DarwtiZE7ydjAOJ2FynAFP3CweMLXBMfpWL36ItD5u9M5eE6p8dRp2t/bOWZeE/IJqBi i5B9YcKyKHUnQ2ikezTh2b8vE+ymbsvSDLV9Q1FMlLOdqrea6P2UUZKYvcW1Amz5TSRe NM5E5u2gtsxZOwO5sZMhlVfJ6rnyJ/lnf9nOIrqyKSE67Ynee51zunv6BPgn34MzgCeU eun1QTTulxzOVLV3FJ5BMPx9HLJ89ZKZa1XAusySwsMkPr6PjqEn7eGmPaeQLOoeIVIf CIUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685143061; x=1687735061; 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=A40S6Bry9WykyoYURiCxbPIMG/3ZQ73ed4B6XGO0wYM=; b=KZNdeFe4Aybv58uk8UxSYZTvr2JDcvldNviiBa+3f0elRuIkZIaGx0yxg/PTe4XtbA /1FgxwR5vZUKOPvsf9eagPE4KPlTdEupFTvrUACr3o0ugnTYpKWW0xDOumMnPaBZHWMZ sq4wZB9Kv8XfZ69tNYEZfzxWu/IweJ3f0WHT8oriJ1re6DljGvtQfmq+wZiahTzzaNH0 bqHAfFX77GT63Dhaj6hhtWNdnlaqkhU77Q2MvFi92cv7fQpCdJ0UcYbinXjbiE0afrWQ dAY5umnCaDldTI/eiMlB4izL3VjBkCAZU65gd0cE2jT/gK0CNIo98GPpunHSXasS7LHx OkjQ== X-Gm-Message-State: AC+VfDwN3yAvtVDXYPr+glgLe3teJcELZaCLIWnOEuANnKCEhbGvCYe8 WSiymAfSzOvRORMk5CjShik4ydEkjLj0QDFX76s= X-Google-Smtp-Source: ACHHUZ6xRbX14886MMZvM8E2alJmB79y+J+/6RS0/WpAt8dHiMgjVX3Y5D8/kcUIz+IRm8/20LKGcg== X-Received: by 2002:a05:6a21:78a4:b0:10f:f672:6e88 with SMTP id bf36-20020a056a2178a400b0010ff6726e88mr1359381pzc.4.1685143060850; Fri, 26 May 2023 16:17:40 -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 k3-20020aa792c3000000b005d22639b577sm3106308pfa.165.2023.05.26.16.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 16:17:40 -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 v3 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value Date: Fri, 26 May 2023 16:17:27 -0700 Message-Id: <20230526231733.6755-2-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230526231733.6755-1-tphan@ventanamicro.com> References: <20230526231733.6755-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 --- 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