TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseRiscVSbiLib.c File Reference

Go to the source code of this file.

Macros

#define SBI_CALL_MAX_ARGS   6
 

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)
 

Detailed Description

Instance of the SBI ecall library.

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

Definition in file BaseRiscVSbiLib.c.

Macro Definition Documentation

◆ SBI_CALL_MAX_ARGS

#define SBI_CALL_MAX_ARGS   6

Definition at line 20 of file BaseRiscVSbiLib.c.

Function Documentation

◆ GetFirmwareContext()

VOID EFIAPI GetFirmwareContext ( OUT EFI_RISCV_FIRMWARE_CONTEXT **  FirmwareContext)

Get firmware context of the calling hart.

Parameters
[out]FirmwareContextThe firmware context pointer.

Definition at line 178 of file BaseRiscVSbiLib.c.

◆ GetFirmwareContextPointer()

VOID EFIAPI GetFirmwareContextPointer ( IN OUT EFI_RISCV_FIRMWARE_CONTEXT **  FirmwareContextPtr)

Get pointer to OpenSBI Firmware Context

Get the pointer of firmware context through OpenSBI FW Extension SBI.

Parameters
FirmwareContextPtrPointer to retrieve pointer to the Firmware Context.

Definition at line 209 of file BaseRiscVSbiLib.c.

◆ SbiCall()

SBI_RET EFIAPI SbiCall ( IN UINTN  ExtId,
IN UINTN  FuncId,
IN UINTN  NumArgs,
  ... 
)

Call SBI call using ecall instruction.

Asserts when NumArgs exceeds SBI_CALL_MAX_ARGS.

Parameters
[in]ExtIdSBI extension ID.
[in]FuncIdSBI function ID.
[in]NumArgsNumber of arguments to pass to the ecall.
[in]...Argument list for the ecall.
Return values
ReturnsSBI_RET structure with value and error code.

Definition at line 37 of file BaseRiscVSbiLib.c.

◆ SbiSetTimer()

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.

Parameters
[in]TimeThe time offset to the next scheduled timer interrupt.

Definition at line 138 of file BaseRiscVSbiLib.c.

◆ SbiSystemReset()

EFI_STATUS EFIAPI SbiSystemReset ( IN UINTN  ResetType,
IN UINTN  ResetReason 
)

Reset the system using SRST SBI extenion

Parameters
[in]ResetTypeThe SRST System Reset Type.
[in]ResetReasonThe SRST System Reset Reason.

Definition at line 153 of file BaseRiscVSbiLib.c.

◆ SetFirmwareContext()

VOID EFIAPI SetFirmwareContext ( IN EFI_RISCV_FIRMWARE_CONTEXT FirmwareContext)

Set firmware context of the calling hart.

Parameters
[in]FirmwareContextThe firmware context pointer.

Definition at line 192 of file BaseRiscVSbiLib.c.

◆ SetFirmwareContextPointer()

VOID EFIAPI SetFirmwareContextPointer ( IN EFI_RISCV_FIRMWARE_CONTEXT FirmwareContextPtr)

Set the pointer to OpenSBI Firmware Context

Set the pointer of firmware context through OpenSBI FW Extension SBI.

Parameters
FirmwareContextPtrPointer to Firmware Context.

Definition at line 225 of file BaseRiscVSbiLib.c.

◆ TranslateError()

EFI_STATUS EFIAPI TranslateError ( IN UINTN  SbiError)

Translate SBI error code to EFI status.

Parameters
[in]SbiErrorSBI error code
Return values
EFI_STATUS

Definition at line 93 of file BaseRiscVSbiLib.c.