Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/include/sbi.h
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
#define SBI_HSM_HART_START 0 | #define SBI_HSM_HART_START 0 | ||||
#define SBI_HSM_HART_STOP 1 | #define SBI_HSM_HART_STOP 1 | ||||
#define SBI_HSM_HART_STATUS 2 | #define SBI_HSM_HART_STATUS 2 | ||||
#define SBI_HSM_STATUS_STARTED 0 | #define SBI_HSM_STATUS_STARTED 0 | ||||
#define SBI_HSM_STATUS_STOPPED 1 | #define SBI_HSM_STATUS_STOPPED 1 | ||||
#define SBI_HSM_STATUS_START_PENDING 2 | #define SBI_HSM_STATUS_START_PENDING 2 | ||||
#define SBI_HSM_STATUS_STOP_PENDING 3 | #define SBI_HSM_STATUS_STOP_PENDING 3 | ||||
/* System Reset (SRST) Extension */ | |||||
#define SBI_EXT_ID_SRST 0x53525354 | |||||
#define SBI_SRST_SYSTEM_RESET 0 | |||||
#define SBI_SRST_TYPE_SHUTDOWN 0 | |||||
#define SBI_SRST_TYPE_COLD_REBOOT 1 | |||||
#define SBI_SRST_TYPE_WARM_REBOOT 2 | |||||
#define SBI_SRST_REASON_NONE 0 | |||||
#define SBI_SRST_REASON_SYSTEM_FAILURE 1 | |||||
mhorne: I don't think there's a need to spell these constants in hex. | |||||
/* Legacy Extensions */ | /* Legacy Extensions */ | ||||
#define SBI_SET_TIMER 0 | #define SBI_SET_TIMER 0 | ||||
#define SBI_CONSOLE_PUTCHAR 1 | #define SBI_CONSOLE_PUTCHAR 1 | ||||
#define SBI_CONSOLE_GETCHAR 2 | #define SBI_CONSOLE_GETCHAR 2 | ||||
#define SBI_CLEAR_IPI 3 | #define SBI_CLEAR_IPI 3 | ||||
#define SBI_SEND_IPI 4 | #define SBI_SEND_IPI 4 | ||||
#define SBI_REMOTE_FENCE_I 5 | #define SBI_REMOTE_FENCE_I 5 | ||||
#define SBI_REMOTE_SFENCE_VMA 6 | #define SBI_REMOTE_SFENCE_VMA 6 | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Get the execution status of the specified hart. The status will be one of: | * Get the execution status of the specified hart. The status will be one of: | ||||
* - SBI_HSM_STATUS_STARTED | * - SBI_HSM_STATUS_STARTED | ||||
* - SBI_HSM_STATUS_STOPPED | * - SBI_HSM_STATUS_STOPPED | ||||
* - SBI_HSM_STATUS_START_PENDING | * - SBI_HSM_STATUS_START_PENDING | ||||
* - SBI_HSM_STATUS_STOP_PENDING | * - SBI_HSM_STATUS_STOP_PENDING | ||||
*/ | */ | ||||
int sbi_hsm_hart_status(u_long hart); | int sbi_hsm_hart_status(u_long hart); | ||||
/* System Reset extension functions. */ | |||||
/* | |||||
* Reset the system based on the following 'type' and 'reason' chosen from: | |||||
* - SBI_SRST_TYPE_SHUTDOWN | |||||
* - SBI_SRST_TYPE_COLD_REBOOT | |||||
* - SBI_SRST_TYPE_WARM_REBOOT | |||||
* - SBI_SRST_REASON_NONE | |||||
* - SBI_SRST_REASON_SYSTEM_FAILURE | |||||
*/ | |||||
void sbi_system_reset(u_long reset_type, u_long reset_reason); | |||||
Done Inline ActionsCould use a comment here like other SBI extensions have. mhorne: Could use a comment here like other SBI extensions have. | |||||
/* Legacy extension functions. */ | /* Legacy extension functions. */ | ||||
static __inline void | static __inline void | ||||
sbi_console_putchar(int ch) | sbi_console_putchar(int ch) | ||||
{ | { | ||||
(void)SBI_CALL1(SBI_CONSOLE_PUTCHAR, 0, ch); | (void)SBI_CALL1(SBI_CONSOLE_PUTCHAR, 0, ch); | ||||
} | } | ||||
static __inline int | static __inline int | ||||
sbi_console_getchar(void) | sbi_console_getchar(void) | ||||
{ | { | ||||
/* | /* | ||||
* XXX: The "error" is returned here because legacy SBI functions | * XXX: The "error" is returned here because legacy SBI functions | ||||
* continue to return their value in a0. | * continue to return their value in a0. | ||||
*/ | */ | ||||
return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0).error); | return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0).error); | ||||
} | |||||
static __inline void | |||||
sbi_shutdown(void) | |||||
{ | |||||
(void)SBI_CALL0(SBI_SHUTDOWN, 0); | |||||
} | } | ||||
void sbi_print_version(void); | void sbi_print_version(void); | ||||
void sbi_init(void); | void sbi_init(void); | ||||
#endif /* !_MACHINE_SBI_H_ */ | #endif /* !_MACHINE_SBI_H_ */ |
I don't think there's a need to spell these constants in hex.