]> xenbits.xensource.com Git - ovmf.git/commitdiff
MdePkg: BaseRiscVSbiLib: make more useful to consumers
authorAndrei Warkentin <andrei.warkentin@intel.com>
Tue, 28 Feb 2023 23:30:19 +0000 (17:30 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 17 May 2023 23:47:20 +0000 (23:47 +0000)
Add a few more definitions and make SbiCall and TranslateError
usable (not static) by library users.

Cc: Daniel Schaefer <git@danielschaefer.me>
Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
MdePkg/Include/Library/BaseRiscVSbiLib.h
MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c

index e75520b4b8889060de328ba1938cebf8dc2929c0..2244165a6b6ab59ddb49d5c9529b04599616dba2 100644 (file)
@@ -2,6 +2,7 @@
   Library to call the RISC-V SBI ecalls\r
 \r
   Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.<BR>\r
+  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 #include <Uefi.h>\r
 \r
 /* SBI Extension IDs */\r
-#define SBI_EXT_TIME  0x54494D45\r
-#define SBI_EXT_SRST  0x53525354\r
-\r
-/* SBI function IDs for TIME extension*/\r
+#define SBI_EXT_0_1_CONSOLE_PUTCHAR  0x1\r
+#define SBI_EXT_0_1_CONSOLE_GETCHAR  0x2\r
+#define SBI_EXT_BASE                 0x10\r
+#define SBI_EXT_DBCN                 0x4442434E\r
+#define SBI_EXT_TIME                 0x54494D45\r
+#define SBI_EXT_SRST                 0x53525354\r
+\r
+/* SBI function IDs for base extension */\r
+#define SBI_EXT_BASE_SPEC_VERSION   0x0\r
+#define SBI_EXT_BASE_IMPL_ID        0x1\r
+#define SBI_EXT_BASE_IMPL_VERSION   0x2\r
+#define SBI_EXT_BASE_PROBE_EXT      0x3\r
+#define SBI_EXT_BASE_GET_MVENDORID  0x4\r
+#define SBI_EXT_BASE_GET_MARCHID    0x5\r
+#define SBI_EXT_BASE_GET_MIMPID     0x6\r
+\r
+/* SBI function IDs for DBCN extension */\r
+#define SBI_EXT_DBCN_WRITE       0x0\r
+#define SBI_EXT_DBCN_READ        0x1\r
+#define SBI_EXT_DBCN_WRITE_BYTE  0x2\r
+\r
+/* SBI function IDs for TIME extension */\r
 #define SBI_EXT_TIME_SET_TIMER  0x0\r
 \r
 /* SBI function IDs for SRST extension */\r
@@ -62,6 +81,21 @@ typedef struct {
   UINTN    Value; ///< Value returned\r
 } SBI_RET;\r
 \r
+SBI_RET\r
+EFIAPI\r
+SbiCall (\r
+  IN  UINTN  ExtId,\r
+  IN  UINTN  FuncId,\r
+  IN  UINTN  NumArgs,\r
+  ...\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+TranslateError (\r
+  IN  UINTN  SbiError\r
+  );\r
+\r
 VOID\r
 EFIAPI\r
 SbiSetTimer (\r
index 2ba8f5ed366a346268230f2aea90de4214668f50..1141abfab9d08224c692c39fa65c7d8846e9314c 100644 (file)
@@ -4,6 +4,7 @@
   It allows calling an SBI function via an ecall from S-Mode.\r
 \r
   Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.<BR>\r
+  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -31,7 +32,6 @@
   @retval  Returns SBI_RET structure with value and error code.\r
 \r
 **/\r
-STATIC\r
 SBI_RET\r
 EFIAPI\r
 SbiCall (\r
@@ -88,7 +88,6 @@ SbiCall (
   @param[in] SbiError   SBI error code\r
   @retval EFI_STATUS\r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 TranslateError (\r