@@ -14,28 +14,28 @@ pub struct SbiRet {
14
14
pub value : usize ,
15
15
}
16
16
17
- pub const SBI_SUCCESS : usize = 0 ;
18
- pub const SBI_ERR_FAILED : usize = -1isize as _ ;
19
- pub const SBI_ERR_NOT_SUPPORTED : usize = -2isize as _ ;
20
- pub const SBI_ERR_INVALID_PARAM : usize = -3isize as _ ;
21
- pub const SBI_ERR_DENIED : usize = -4isize as _ ;
22
- pub const SBI_ERR_INVALID_ADDRESS : usize = -5isize as _ ;
23
- pub const SBI_ERR_ALREADY_AVAILABLE : usize = -6isize as _ ;
24
- pub const SBI_ERR_ALREADY_STARTED : usize = -7isize as _ ;
25
- pub const SBI_ERR_ALREADY_STOPPED : usize = -8isize as _ ;
17
+ pub const RET_SUCCESS : usize = 0 ;
18
+ pub const RET_ERR_FAILED : usize = -1isize as _ ;
19
+ pub const RET_ERR_NOT_SUPPORTED : usize = -2isize as _ ;
20
+ pub const RET_ERR_INVALID_PARAM : usize = -3isize as _ ;
21
+ pub const RET_ERR_DENIED : usize = -4isize as _ ;
22
+ pub const RET_ERR_INVALID_ADDRESS : usize = -5isize as _ ;
23
+ pub const RET_ERR_ALREADY_AVAILABLE : usize = -6isize as _ ;
24
+ pub const RET_ERR_ALREADY_STARTED : usize = -7isize as _ ;
25
+ pub const RET_ERR_ALREADY_STOPPED : usize = -8isize as _ ;
26
26
27
27
impl core:: fmt:: Debug for SbiRet {
28
28
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
29
29
match self . error {
30
- SBI_SUCCESS => self . value . fmt ( f) ,
31
- SBI_ERR_FAILED => write ! ( f, "<SBI call failed>" ) ,
32
- SBI_ERR_NOT_SUPPORTED => write ! ( f, "<SBI feature not supported>" ) ,
33
- SBI_ERR_INVALID_PARAM => write ! ( f, "<SBI invalid parameter>" ) ,
34
- SBI_ERR_DENIED => write ! ( f, "<SBI denied>" ) ,
35
- SBI_ERR_INVALID_ADDRESS => write ! ( f, "<SBI invalid address>" ) ,
36
- SBI_ERR_ALREADY_AVAILABLE => write ! ( f, "<SBI already available>" ) ,
37
- SBI_ERR_ALREADY_STARTED => write ! ( f, "<SBI already started>" ) ,
38
- SBI_ERR_ALREADY_STOPPED => write ! ( f, "<SBI already stopped>" ) ,
30
+ RET_SUCCESS => self . value . fmt ( f) ,
31
+ RET_ERR_FAILED => write ! ( f, "<SBI call failed>" ) ,
32
+ RET_ERR_NOT_SUPPORTED => write ! ( f, "<SBI feature not supported>" ) ,
33
+ RET_ERR_INVALID_PARAM => write ! ( f, "<SBI invalid parameter>" ) ,
34
+ RET_ERR_DENIED => write ! ( f, "<SBI denied>" ) ,
35
+ RET_ERR_INVALID_ADDRESS => write ! ( f, "<SBI invalid address>" ) ,
36
+ RET_ERR_ALREADY_AVAILABLE => write ! ( f, "<SBI already available>" ) ,
37
+ RET_ERR_ALREADY_STARTED => write ! ( f, "<SBI already started>" ) ,
38
+ RET_ERR_ALREADY_STOPPED => write ! ( f, "<SBI already stopped>" ) ,
39
39
unknown => write ! ( f, "[SBI Unknown error: {unknown:#x}]" ) ,
40
40
}
41
41
}
@@ -56,15 +56,15 @@ pub enum Error {
56
56
impl SbiRet {
57
57
pub const fn result ( & self ) -> Result < usize , Error > {
58
58
match self . error {
59
- SBI_SUCCESS => Ok ( self . value ) ,
60
- SBI_ERR_FAILED => Err ( Error :: Failed ) ,
61
- SBI_ERR_NOT_SUPPORTED => Err ( Error :: NotSupported ) ,
62
- SBI_ERR_INVALID_PARAM => Err ( Error :: InvalidParam ) ,
63
- SBI_ERR_DENIED => Err ( Error :: Denied ) ,
64
- SBI_ERR_INVALID_ADDRESS => Err ( Error :: InvalidAddress ) ,
65
- SBI_ERR_ALREADY_AVAILABLE => Err ( Error :: AlreadyAvailable ) ,
66
- SBI_ERR_ALREADY_STARTED => Err ( Error :: AlreadyStarted ) ,
67
- SBI_ERR_ALREADY_STOPPED => Err ( Error :: AlreadyStopped ) ,
59
+ RET_SUCCESS => Ok ( self . value ) ,
60
+ RET_ERR_FAILED => Err ( Error :: Failed ) ,
61
+ RET_ERR_NOT_SUPPORTED => Err ( Error :: NotSupported ) ,
62
+ RET_ERR_INVALID_PARAM => Err ( Error :: InvalidParam ) ,
63
+ RET_ERR_DENIED => Err ( Error :: Denied ) ,
64
+ RET_ERR_INVALID_ADDRESS => Err ( Error :: InvalidAddress ) ,
65
+ RET_ERR_ALREADY_AVAILABLE => Err ( Error :: AlreadyAvailable ) ,
66
+ RET_ERR_ALREADY_STARTED => Err ( Error :: AlreadyStarted ) ,
67
+ RET_ERR_ALREADY_STOPPED => Err ( Error :: AlreadyStopped ) ,
68
68
unknown => Err ( Error :: Customed ( unknown as _ ) ) ,
69
69
}
70
70
}
0 commit comments