TianoCore EDK2 master
|
#include <Uefi.h>
Go to the source code of this file.
Data Structures | |
struct | EFI_RISCV_FIRMWARE_CONTEXT |
struct | SBI_RET |
Functions | |
SBI_RET EFIAPI | SbiCall (IN UINTN ExtId, IN UINTN FuncId, IN UINTN NumArgs,...) |
EFI_STATUS EFIAPI | TranslateError (IN UINTN SbiError) |
VOID EFIAPI | SbiSetTimer (IN UINT64 Time) |
EFI_STATUS EFIAPI | SbiSystemReset (IN UINTN ResetType, IN UINTN ResetReason) |
VOID EFIAPI | GetFirmwareContext (OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContext) |
VOID EFIAPI | SetFirmwareContext (IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext) |
VOID EFIAPI | GetFirmwareContextPointer (IN OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContextPtr) |
VOID EFIAPI | SetFirmwareContextPointer (IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContextPtr) |
VOID EFIAPI | RiscVSbiEcall (IN OUT UINTN *Arg0, IN OUT UINTN *Arg1, IN UINTN Arg2, IN UINTN Arg3, IN UINTN Arg4, IN UINTN Arg5, IN UINTN Fid, IN UINTN Ext) |
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
Currently, EDK2 needs to call SBI only to set the time and to do system reset.
Definition in file BaseRiscVSbiLib.h.
#define SBI_ERR_ALREADY_AVAILABLE -6 |
Definition at line 63 of file BaseRiscVSbiLib.h.
#define SBI_ERR_ALREADY_STARTED -7 |
Definition at line 64 of file BaseRiscVSbiLib.h.
#define SBI_ERR_ALREADY_STOPPED -8 |
Definition at line 65 of file BaseRiscVSbiLib.h.
#define SBI_ERR_DENIED -4 |
Definition at line 61 of file BaseRiscVSbiLib.h.
#define SBI_ERR_FAILED -1 |
Definition at line 58 of file BaseRiscVSbiLib.h.
#define SBI_ERR_INVALID_ADDRESS -5 |
Definition at line 62 of file BaseRiscVSbiLib.h.
#define SBI_ERR_INVALID_PARAM -3 |
Definition at line 60 of file BaseRiscVSbiLib.h.
#define SBI_ERR_NOT_SUPPORTED -2 |
Definition at line 59 of file BaseRiscVSbiLib.h.
#define SBI_EXT_0_1_CONSOLE_GETCHAR 0x2 |
Definition at line 23 of file BaseRiscVSbiLib.h.
#define SBI_EXT_0_1_CONSOLE_PUTCHAR 0x1 |
Definition at line 22 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE 0x10 |
Definition at line 24 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_GET_MARCHID 0x5 |
Definition at line 35 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_GET_MIMPID 0x6 |
Definition at line 36 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_GET_MVENDORID 0x4 |
Definition at line 34 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_IMPL_ID 0x1 |
Definition at line 31 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_IMPL_VERSION 0x2 |
Definition at line 32 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_PROBE_EXT 0x3 |
Definition at line 33 of file BaseRiscVSbiLib.h.
#define SBI_EXT_BASE_SPEC_VERSION 0x0 |
Definition at line 30 of file BaseRiscVSbiLib.h.
#define SBI_EXT_DBCN 0x4442434E |
Definition at line 25 of file BaseRiscVSbiLib.h.
#define SBI_EXT_DBCN_READ 0x1 |
Definition at line 40 of file BaseRiscVSbiLib.h.
#define SBI_EXT_DBCN_WRITE 0x0 |
Definition at line 39 of file BaseRiscVSbiLib.h.
#define SBI_EXT_DBCN_WRITE_BYTE 0x2 |
Definition at line 41 of file BaseRiscVSbiLib.h.
#define SBI_EXT_SRST 0x53525354 |
Definition at line 27 of file BaseRiscVSbiLib.h.
#define SBI_EXT_SRST_RESET 0x0 |
Definition at line 47 of file BaseRiscVSbiLib.h.
#define SBI_EXT_TIME 0x54494D45 |
Definition at line 26 of file BaseRiscVSbiLib.h.
#define SBI_EXT_TIME_SET_TIMER 0x0 |
Definition at line 44 of file BaseRiscVSbiLib.h.
#define SBI_LAST_ERR SBI_ERR_ALREADY_STOPPED |
Definition at line 67 of file BaseRiscVSbiLib.h.
#define SBI_SRST_RESET_REASON_NONE 0x0 |
Definition at line 53 of file BaseRiscVSbiLib.h.
#define SBI_SRST_RESET_REASON_SYSFAIL 0x1 |
Definition at line 54 of file BaseRiscVSbiLib.h.
#define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1 |
Definition at line 50 of file BaseRiscVSbiLib.h.
#define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0 |
Definition at line 49 of file BaseRiscVSbiLib.h.
#define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2 |
Definition at line 51 of file BaseRiscVSbiLib.h.
#define SBI_SUCCESS 0 |
Definition at line 57 of file BaseRiscVSbiLib.h.
VOID EFIAPI GetFirmwareContext | ( | OUT EFI_RISCV_FIRMWARE_CONTEXT ** | FirmwareContext | ) |
Get firmware context of the calling hart.
[out] | FirmwareContext | The firmware context pointer. |
Definition at line 178 of file BaseRiscVSbiLib.c.
VOID EFIAPI GetFirmwareContextPointer | ( | IN OUT EFI_RISCV_FIRMWARE_CONTEXT ** | FirmwareContextPtr | ) |
Get pointer to OpenSBI Firmware Context
Get the pointer of firmware context.
FirmwareContextPtr | Pointer to retrieve pointer to the Firmware Context. |
Get pointer to OpenSBI Firmware Context
Get the pointer of firmware context through OpenSBI FW Extension SBI.
FirmwareContextPtr | Pointer to retrieve pointer to the Firmware Context. |
Definition at line 209 of file BaseRiscVSbiLib.c.
VOID EFIAPI RiscVSbiEcall | ( | IN OUT UINTN * | Arg0, |
IN OUT UINTN * | Arg1, | ||
IN UINTN | Arg2, | ||
IN UINTN | Arg3, | ||
IN UINTN | Arg4, | ||
IN UINTN | Arg5, | ||
IN UINTN | Fid, | ||
IN UINTN | Ext | ||
) |
Make ECALL in assembly
Switch to M-mode
[in,out] | Arg0 | |
[in,out] | Arg1 | |
[in] | Arg2 | |
[in] | Arg3 | |
[in] | Arg4 | |
[in] | Arg5 | |
[in] | FID | |
[in] | EXT |
Call SBI call using ecall instruction.
Asserts when NumArgs exceeds SBI_CALL_MAX_ARGS.
[in] | ExtId | SBI extension ID. |
[in] | FuncId | SBI function ID. |
[in] | NumArgs | Number of arguments to pass to the ecall. |
[in] | ... | Argument list for the ecall. |
Returns | SBI_RET structure with value and error code. |
Definition at line 37 of file BaseRiscVSbiLib.c.
VOID EFIAPI SbiSetTimer | ( | IN UINT64 | Time | ) |
Clear pending timer interrupt bit and set timer for next event after Time.
To clear the timer without scheduling a timer event, set Time to a practically infinite value or mask the timer interrupt by clearing sie.STIE.
[in] | Time | The time offset to the next scheduled timer interrupt. |
Definition at line 138 of file BaseRiscVSbiLib.c.
EFI_STATUS EFIAPI SbiSystemReset | ( | IN UINTN | ResetType, |
IN UINTN | ResetReason | ||
) |
Reset the system using SRST SBI extenion
[in] | ResetType | The SRST System Reset Type. |
[in] | ResetReason | The SRST System Reset Reason. |
Definition at line 153 of file BaseRiscVSbiLib.c.
VOID EFIAPI SetFirmwareContext | ( | IN EFI_RISCV_FIRMWARE_CONTEXT * | FirmwareContext | ) |
Set firmware context of the calling hart.
[in] | FirmwareContext | The firmware context pointer. |
Definition at line 192 of file BaseRiscVSbiLib.c.
VOID EFIAPI SetFirmwareContextPointer | ( | IN EFI_RISCV_FIRMWARE_CONTEXT * | FirmwareContextPtr | ) |
Set pointer to OpenSBI Firmware Context
Set the pointer of firmware context.
FirmwareContextPtr | Pointer to Firmware Context. |
Set the pointer to OpenSBI Firmware Context
Set the pointer of firmware context through OpenSBI FW Extension SBI.
FirmwareContextPtr | Pointer to Firmware Context. |
Definition at line 225 of file BaseRiscVSbiLib.c.
EFI_STATUS EFIAPI TranslateError | ( | IN UINTN | SbiError | ) |
Translate SBI error code to EFI status.
[in] | SbiError | SBI error code |
EFI_STATUS |
Definition at line 93 of file BaseRiscVSbiLib.c.