File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
framework_lib/src/chromium_ec Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,20 @@ const _MEC_LPC_DATA_REGISTER1: u16 = 0x0805;
22
22
const MEC_LPC_DATA_REGISTER2 : u16 = 0x0806 ;
23
23
const _MEC_LPC_DATA_REGISTER3: u16 = 0x0807 ;
24
24
25
- pub fn init ( ) {
25
+ pub fn init ( ) -> bool {
26
26
#[ cfg( target_os = "linux" ) ]
27
27
unsafe {
28
- ioperm ( EC_LPC_ADDR_HOST_DATA as u64 , 8 , 1 ) ;
29
- ioperm ( MEC_LPC_ADDRESS_REGISTER0 as u64 , 10 , 1 ) ;
28
+ println ! ( "Init MEC" ) ;
29
+ let res = ioperm ( EC_LPC_ADDR_HOST_DATA as u64 , 8 , 1 ) ;
30
+ if res != 0 {
31
+ error ! ( "ioperm failed. portio driver is likely block by Linux kernel lockdown mode" ) ;
32
+ return false ;
33
+ }
34
+ let res = ioperm ( MEC_LPC_ADDRESS_REGISTER0 as u64 , 10 , 1 ) ;
35
+ assert_eq ! ( res, 0 ) ;
30
36
}
37
+
38
+ true
31
39
}
32
40
33
41
// TODO: Create a wrapper
You can’t perform that action at this time.
0 commit comments