Skip to content

Commit 56b48e8

Browse files
committed
--versions: Hide CSME on AMD
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 6dbc10d commit 56b48e8

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

framework_lib/src/commandline/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ use crate::touchpad::print_touchpad_fw_ver;
5959
use crate::touchscreen;
6060
#[cfg(feature = "uefi")]
6161
use crate::uefi::enable_page_break;
62-
use crate::util;
63-
use crate::util::{Config, Platform, PlatformFamily};
62+
use crate::util::{self, Config, CpuVendor, Platform, PlatformFamily};
6463
#[cfg(feature = "hidapi")]
6564
use hidapi::HidApi;
6665
use sha2::{Digest, Sha256, Sha384, Sha512};
@@ -557,7 +556,7 @@ fn print_versions(ec: &CrosEc) {
557556
}
558557

559558
#[cfg(target_os = "linux")]
560-
{
559+
if smbios::get_platform().and_then(Platform::which_cpu_vendor) != Some(CpuVendor::Amd) {
561560
println!("CSME");
562561
if let Ok(csme) = csme::csme_from_sysfs() {
563562
info!(" Enabled: {}", csme.enabled);

framework_lib/src/util.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,28 @@ pub enum PlatformFamily {
4949
FrameworkDesktop,
5050
}
5151

52+
#[derive(Debug, PartialEq, Clone, Copy)]
53+
pub enum CpuVendor {
54+
Intel,
55+
Amd,
56+
}
57+
5258
impl Platform {
59+
pub fn which_cpu_vendor(self) -> Option<CpuVendor> {
60+
match self {
61+
Platform::Framework12IntelGen13
62+
| Platform::IntelGen11
63+
| Platform::IntelGen12
64+
| Platform::IntelGen13
65+
| Platform::IntelCoreUltra1 => Some(CpuVendor::Intel),
66+
Platform::Framework13Amd7080
67+
| Platform::Framework13AmdAi300
68+
| Platform::Framework16Amd7080
69+
| Platform::FrameworkDesktopAmdAiMax300 => Some(CpuVendor::Amd),
70+
Platform::GenericFramework(..) => None,
71+
Platform::UnknownSystem => None,
72+
}
73+
}
5374
pub fn which_family(self) -> Option<PlatformFamily> {
5475
match self {
5576
Platform::Framework12IntelGen13 => Some(PlatformFamily::Framework12),

0 commit comments

Comments
 (0)