We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 184f89b commit 056ec31Copy full SHA for 056ec31
framework_lib/src/chromium_ec/portio_mec.rs
@@ -22,12 +22,20 @@ const _MEC_LPC_DATA_REGISTER1: u16 = 0x0805;
22
const MEC_LPC_DATA_REGISTER2: u16 = 0x0806;
23
const _MEC_LPC_DATA_REGISTER3: u16 = 0x0807;
24
25
-pub fn init() {
+pub fn init() -> bool {
26
#[cfg(target_os = "linux")]
27
unsafe {
28
- ioperm(EC_LPC_ADDR_HOST_DATA as u64, 8, 1);
29
- ioperm(MEC_LPC_ADDRESS_REGISTER0 as u64, 10, 1);
+ println!("Init MEC");
+ 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);
36
}
37
+
38
+ true
39
40
41
// TODO: Create a wrapper
0 commit comments