From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.7580.1677793768526704964 for ; Thu, 02 Mar 2023 13:49:32 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=EnrLZvDy; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: andrei.warkentin@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677793772; x=1709329772; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=44o5JStW8oKupctn9hI7tH3NXkntiz2aQaOY8EBO2JE=; b=EnrLZvDya+3t7jO29lbfgojQzPBcQRc5vF9emnPCNnZF2Vq0D6wkv51q 8CN3lody8IYNm4YVv/hkjalCfdlsDEljS84RRX5FJXXZheJj/O4CYWgzN UkvjUAP1hBMnRSCQo09loQM7SjGomfFignn2T0PCsyyEJWMmqB/eN/+OG aNPv8v+2A1XOQUwDA+V8IY4e1X1eVRN3aft2ialUX03wR4XPQ/iQrWLXR 3TK06fkNhJNgy97qY7UitxBcMHaUi9Aw5Yb0tftuW33gEzEKL6OBac2tQ VejAgHh7JPpRbVyl77qz0V/owVRvM7jWlH/7M8O1Y4OAly1rSqMXBhfA1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10637"; a="333584560" X-IronPort-AV: E=Sophos;i="5.98,228,1673942400"; d="scan'208";a="333584560" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2023 13:49:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10637"; a="1004321594" X-IronPort-AV: E=Sophos;i="5.98,228,1673942400"; d="scan'208";a="1004321594" Received: from mayurkum-mobl2.amr.corp.intel.com (HELO awarkent-mobl1.amr.corp.intel.com) ([10.213.175.186]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2023 13:49:31 -0800 From: "Andrei Warkentin" To: devel@edk2.groups.io Cc: Andrei Warkentin , Daniel Schaefer , Sunil V L , Gerd Hoffmann Subject: [edk2 1/3] MdePkg: BaseRiscVSbiLib: make more useful to consumers Date: Thu, 2 Mar 2023 15:49:18 -0600 Message-Id: <20230302214920.13817-2-andrei.warkentin@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230302214920.13817-1-andrei.warkentin@intel.com> References: <20230302214920.13817-1-andrei.warkentin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a few more definitions and make SbiCall and TranslateError usable (not static) by library users. Cc: Daniel Schaefer Cc: Sunil V L Acked-by: Gerd Hoffmann Signed-off-by: Andrei Warkentin --- MdePkg/Include/Library/BaseRiscVSbiLib.h | 40 ++++++++++++++++++-- MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c | 3 +- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/MdePkg/Include/Library/BaseRiscVSbiLib.h b/MdePkg/Include/Library/BaseRiscVSbiLib.h index e75520b4b888..2244165a6b6a 100644 --- a/MdePkg/Include/Library/BaseRiscVSbiLib.h +++ b/MdePkg/Include/Library/BaseRiscVSbiLib.h @@ -2,6 +2,7 @@ Library to call the RISC-V SBI ecalls Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.
+ Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -18,10 +19,28 @@ #include /* SBI Extension IDs */ -#define SBI_EXT_TIME 0x54494D45 -#define SBI_EXT_SRST 0x53525354 +#define SBI_EXT_0_1_CONSOLE_PUTCHAR 0x1 +#define SBI_EXT_0_1_CONSOLE_GETCHAR 0x2 +#define SBI_EXT_BASE 0x10 +#define SBI_EXT_DBCN 0x4442434E +#define SBI_EXT_TIME 0x54494D45 +#define SBI_EXT_SRST 0x53525354 -/* SBI function IDs for TIME extension*/ +/* SBI function IDs for base extension */ +#define SBI_EXT_BASE_SPEC_VERSION 0x0 +#define SBI_EXT_BASE_IMPL_ID 0x1 +#define SBI_EXT_BASE_IMPL_VERSION 0x2 +#define SBI_EXT_BASE_PROBE_EXT 0x3 +#define SBI_EXT_BASE_GET_MVENDORID 0x4 +#define SBI_EXT_BASE_GET_MARCHID 0x5 +#define SBI_EXT_BASE_GET_MIMPID 0x6 + +/* SBI function IDs for DBCN extension */ +#define SBI_EXT_DBCN_WRITE 0x0 +#define SBI_EXT_DBCN_READ 0x1 +#define SBI_EXT_DBCN_WRITE_BYTE 0x2 + +/* SBI function IDs for TIME extension */ #define SBI_EXT_TIME_SET_TIMER 0x0 /* SBI function IDs for SRST extension */ @@ -62,6 +81,21 @@ typedef struct { UINTN Value; ///< Value returned } SBI_RET; +SBI_RET +EFIAPI +SbiCall ( + IN UINTN ExtId, + IN UINTN FuncId, + IN UINTN NumArgs, + ... + ); + +EFI_STATUS +EFIAPI +TranslateError ( + IN UINTN SbiError + ); + VOID EFIAPI SbiSetTimer ( diff --git a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c index 2ba8f5ed366a..1141abfab9d0 100644 --- a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c +++ b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c @@ -4,6 +4,7 @@ It allows calling an SBI function via an ecall from S-Mode. Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.
+ Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -31,7 +32,6 @@ @retval Returns SBI_RET structure with value and error code. **/ -STATIC SBI_RET EFIAPI SbiCall ( @@ -88,7 +88,6 @@ SbiCall ( @param[in] SbiError SBI error code @retval EFI_STATUS **/ -STATIC EFI_STATUS EFIAPI TranslateError ( -- 2.25.1