MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / selftest

Function selftest

framework_lib/src/commandline/mod.rs:2088–2173  ·  view source on GitHub ↗
(ec: &CrosEc)

Source from the content-addressed store, hash-verified

2086}
2087
2088fn selftest(ec: &CrosEc) -> Option<()> {
2089 if let Some(platform) = smbios::get_platform() {
2090 println!(" SMBIOS Platform: {:?}", platform);
2091 } else {
2092 println!(" SMBIOS Platform: Unknown");
2093 println!();
2094 println!("Specify custom platform parameters with --pd-ports --pd-addrs");
2095 return None;
2096 };
2097 let family = smbios::get_platform().and_then(Platform::which_family);
2098
2099 println!(" Dump EC memory region");
2100 if let Some(mem) = ec.dump_mem_region() {
2101 util::print_multiline_buffer(&mem, 0);
2102 } else {
2103 println!(" Failed to read EC memory region");
2104 return None;
2105 }
2106
2107 println!(" Checking EC memory mapped magic bytes");
2108 print_err(ec.check_mem_magic())?;
2109 println!(" Verified that Framework EC is present!");
2110
2111 println!(" Reading EC Build Version");
2112 print_err(ec.version_info())?;
2113
2114 print!(" Reading EC Flash by EC");
2115 ec.flash_version()?;
2116 println!(" - OK");
2117
2118 println!(" Reading EC Flash directly - See below");
2119 ec.test_ec_flash_read().ok()?;
2120
2121 print!(" Getting power info from EC");
2122 power::power_info(ec)?;
2123 println!(" - OK");
2124
2125 println!(" Getting AC info from EC");
2126 if family != Some(PlatformFamily::FrameworkDesktop) {
2127 // All our laptops have at least 4 PD ports so far
2128 if power::get_pd_info(ec, 4).iter().any(|x| x.is_err()) {
2129 println!(" Failed to get PD Info from EC");
2130 return None;
2131 }
2132 }
2133
2134 print!("Reading PD Version from EC");
2135 if let Err(err) = power::read_pd_version(ec) {
2136 // TGL does not have this command, so we have to ignore it
2137 if err != EcError::Response(EcResponseStatus::InvalidCommand) {
2138 println!();
2139 println!("Err: {:?}", err);
2140 } else {
2141 println!(" - Skipped");
2142 }
2143 } else {
2144 println!(" - OK");
2145 }

Callers 1

run_with_argsFunction · 0.85

Calls 14

get_platformFunction · 0.85
print_multiline_bufferFunction · 0.85
print_errFunction · 0.85
power_infoFunction · 0.85
get_pd_infoFunction · 0.85
read_pd_versionFunction · 0.85
dump_mem_regionMethod · 0.80
check_mem_magicMethod · 0.80
version_infoMethod · 0.80
flash_versionMethod · 0.80
test_ec_flash_readMethod · 0.80
get_silicon_idMethod · 0.80

Tested by

no test coverage detected