| 1 | #ifndef SYS__SBI_H__ |
| 2 | #define SYS__SBI_H__ |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | struct sbiret { |
| 8 | long error; |
| 9 | long value; |
| 10 | }; |
| 11 | |
| 12 | #define SBI_SUCCESS ((long)0) |
| 13 | #define SBI_ERR_FAILED ((long)-1) |
| 14 | #define SBI_ERR_NOT_SUPPORTED ((long)-2) |
| 15 | #define SBI_ERR_INVALID_PARAM ((long)-3) |
| 16 | #define SBI_ERR_DENIED ((long)-4) |
| 17 | #define SBI_ERR_INVALID_ADDRESS ((long)-5) |
| 18 | #define SBI_ERR_ALREADY_AVAILABLE ((long)-6) |
| 19 | #define SBI_ERR_ALREADY_STARTED ((long)-7) |
| 20 | #define SBI_ERR_ALREADY_STOPPED ((long)-8) |
| 21 | |
| 22 | extern struct sbiret sbicall(int eid, int fid, ...); |
| 23 | |
| 24 | #define SBI_EID_HSM 0x48534d |
| 25 | |
| 26 | static inline struct sbiret sbi_hart_start(unsigned long hartid, |
| 27 | unsigned long start_addr, |
| 28 | unsigned long opaque) { |
| 29 | return sbicall(SBI_EID_HSM, 0, hartid, start_addr, opaque); |
| 30 | } |
| 31 | |
| 32 | #endif |