|
Zephyr Project API 4.5.0-rc2
A Scalable Open Source RTOS
|
RISC-V Supervisor Binary Interface (SBI) definitions. More...
#include <errno.h>Go to the source code of this file.
Data Structures | |
| struct | sbiret |
Macros | |
| #define | SBI_EXT_TIME 0x54494D45 |
| SBI extension ID for the Timer extension (TIME). | |
| #define | SBI_FUNC_SET_TIMER 0 |
| SBI_EXT_TIME function ID: set the next timer deadline. | |
| #define | SBI_EXT_SRST 0x53525354 |
| SBI extension ID for the System Reset extension (SRST). | |
| #define | SBI_FUNC_SYSTEM_RESET 0 |
| SBI_EXT_SRST function ID: reset or power off the system. | |
| #define | SBI_SRST_RESET_TYPE_SHUTDOWN 0 |
| SBI_EXT_SRST reset type: clean shutdown (power off). | |
| #define | SBI_SRST_RESET_TYPE_COLD_REBOOT 1 |
| SBI_EXT_SRST reset type: cold reboot. | |
| #define | SBI_SRST_RESET_TYPE_WARM_REBOOT 2 |
| SBI_EXT_SRST reset type: warm reboot. | |
| #define | SBI_SRST_RESET_REASON_NONE 0 |
| SBI_EXT_SRST reset reason: no specific reason. | |
| #define | SBI_EXT_HSM 0x48534D |
| SBI extension ID for the Hart State Management extension (HSM). | |
| #define | SBI_FUNC_HART_START 0 |
| SBI_EXT_HSM function ID: start a stopped hart. | |
| #define | SBI_FUNC_HART_STOP 1 |
| SBI_EXT_HSM function ID: stop the calling hart. | |
| #define | SBI_EXT_IPI 0x735049 |
| SBI extension ID for the IPI extension (sPI). | |
| #define | SBI_FUNC_SEND_IPI 0 |
| SBI_EXT_IPI function ID: send an IPI to a set of harts. | |
| #define | SBI_SUCCESS 0 |
| SBI return code: call completed successfully. | |
| #define | SBI_ERR_FAILED -1 |
| SBI return code: the call failed for an unspecified reason. | |
| #define | SBI_ERR_NOT_SUPPORTED -2 |
| SBI return code: requested extension/function is not available. | |
| #define | SBI_ERR_INVALID_PARAM -3 |
| SBI return code: one or more arguments were invalid. | |
| #define | SBI_ERR_DENIED -4 |
| SBI return code: the caller is not permitted to perform the operation. | |
| #define | SBI_ERR_INVALID_ADDRESS -5 |
| SBI return code: an address argument was invalid or inaccessible. | |
| #define | SBI_ERR_ALREADY_AVAILABLE -6 |
| SBI return code: the resource is already available. | |
| #define | SBI_ERR_ALREADY_STARTED -7 |
| SBI return code: the target has already been started. | |
| #define | SBI_ERR_ALREADY_STOPPED -8 |
| SBI return code: the target has already been stopped. | |
| #define | SBI_ERR_NO_SHMEM -9 |
| SBI return code: no shared memory region has been set up. | |
| #define | SBI_ERR_INVALID_STATE -10 |
| SBI return code: the operation is not valid in the current state. | |
| #define | SBI_ERR_BAD_RANGE -11 |
| SBI return code: the supplied range is malformed or out of bounds. | |
| #define | SBI_ERR_TIMEOUT -12 |
| SBI return code: the operation did not complete in time. | |
| #define | SBI_ERR_IO -13 |
| SBI return code: an I/O error occurred during the operation. | |
| #define | SBI_ERR_DENIED_LOCKED -14 |
| SBI return code: denied because the resource is locked. | |
Functions | |
| static int | sbi_err_to_errno (unsigned long err) |
| Translate an SBI return code into a negative errno value. | |
| static struct sbiret | sbi_ecall (unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5, unsigned long fid, unsigned long ext) |
RISC-V Supervisor Binary Interface (SBI) definitions.
Defines SBI extension IDs, function IDs, and error codes used by S-mode code to request M-mode firmware services via the ecall instruction. The subset defined here covers only the extensions used by Zephyr's in-tree minimal SBI runtime (arch/riscv/core/sbi.S).
References: RISC-V SBI Specification v2.0 (https://github.com/riscv-non-isa/riscv-sbi-doc)
| #define SBI_ERR_ALREADY_AVAILABLE -6 |
SBI return code: the resource is already available.
| #define SBI_ERR_ALREADY_STARTED -7 |
SBI return code: the target has already been started.
| #define SBI_ERR_ALREADY_STOPPED -8 |
SBI return code: the target has already been stopped.
| #define SBI_ERR_BAD_RANGE -11 |
SBI return code: the supplied range is malformed or out of bounds.
| #define SBI_ERR_DENIED -4 |
SBI return code: the caller is not permitted to perform the operation.
| #define SBI_ERR_DENIED_LOCKED -14 |
SBI return code: denied because the resource is locked.
| #define SBI_ERR_FAILED -1 |
SBI return code: the call failed for an unspecified reason.
| #define SBI_ERR_INVALID_ADDRESS -5 |
SBI return code: an address argument was invalid or inaccessible.
| #define SBI_ERR_INVALID_PARAM -3 |
SBI return code: one or more arguments were invalid.
| #define SBI_ERR_INVALID_STATE -10 |
SBI return code: the operation is not valid in the current state.
| #define SBI_ERR_IO -13 |
SBI return code: an I/O error occurred during the operation.
| #define SBI_ERR_NO_SHMEM -9 |
SBI return code: no shared memory region has been set up.
| #define SBI_ERR_NOT_SUPPORTED -2 |
SBI return code: requested extension/function is not available.
| #define SBI_ERR_TIMEOUT -12 |
SBI return code: the operation did not complete in time.
| #define SBI_EXT_HSM 0x48534D |
SBI extension ID for the Hart State Management extension (HSM).
| #define SBI_EXT_IPI 0x735049 |
SBI extension ID for the IPI extension (sPI).
| #define SBI_EXT_SRST 0x53525354 |
SBI extension ID for the System Reset extension (SRST).
| #define SBI_EXT_TIME 0x54494D45 |
SBI extension ID for the Timer extension (TIME).
| #define SBI_FUNC_HART_START 0 |
SBI_EXT_HSM function ID: start a stopped hart.
| #define SBI_FUNC_HART_STOP 1 |
SBI_EXT_HSM function ID: stop the calling hart.
| #define SBI_FUNC_SEND_IPI 0 |
SBI_EXT_IPI function ID: send an IPI to a set of harts.
| #define SBI_FUNC_SET_TIMER 0 |
SBI_EXT_TIME function ID: set the next timer deadline.
| #define SBI_FUNC_SYSTEM_RESET 0 |
SBI_EXT_SRST function ID: reset or power off the system.
| #define SBI_SRST_RESET_REASON_NONE 0 |
SBI_EXT_SRST reset reason: no specific reason.
| #define SBI_SRST_RESET_TYPE_COLD_REBOOT 1 |
SBI_EXT_SRST reset type: cold reboot.
| #define SBI_SRST_RESET_TYPE_SHUTDOWN 0 |
SBI_EXT_SRST reset type: clean shutdown (power off).
| #define SBI_SRST_RESET_TYPE_WARM_REBOOT 2 |
SBI_EXT_SRST reset type: warm reboot.
| #define SBI_SUCCESS 0 |
SBI return code: call completed successfully.
|
inlinestatic |
|
inlinestatic |
Translate an SBI return code into a negative errno value.
| err | Value taken from the error field of an SBI call's return struct (i.e. register a0). |