diff --git a/EXAMPLES.md b/EXAMPLES.md index 7b915984..08c5cf8d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -225,6 +225,8 @@ Expansion Bay Door closed: true Board: DualInterposer Serial Number: FRAXXXXXXXXXXXXXXX + Config: Pcie4x2 + Vendor: SsdHolder ``` ## Check charger and battery status (Framework 12/13/16) diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index 54b8db52..f1f47fec 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -96,6 +96,7 @@ pub enum EcCommands { GetHwDiag = 0x3E1C, /// Get gpu bay serial GetGpuSerial = 0x3E1D, + GetGpuPcie = 0x3E1E, /// Set gpu bay serial and program structure ProgramGpuEeprom = 0x3E1F, } diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 38cafeb6..1eb588ed 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -1129,6 +1129,43 @@ impl EcRequest for EcRequestGetGpuSerial { } } +#[repr(C, packed)] +pub struct EcRequestGetGpuPcie {} + +#[repr(u8)] +#[derive(Debug, FromPrimitive)] +pub enum GpuPcieConfig { + /// PCIe 8x1 + Pcie8x1 = 0, + /// PCIe 4x1 + Pcie4x1 = 1, + /// PCIe 4x2 + Pcie4x2 = 2, +} + +#[repr(u8)] +#[derive(Debug, FromPrimitive)] +pub enum GpuVendor { + Initializing = 0x00, + FanOnly = 0x01, + GpuAmdR23M = 0x02, + SsdHolder = 0x03, + PcieAccessory = 0x4, +} + +#[repr(C, packed)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub struct EcResponseGetGpuPcie { + pub gpu_pcie_config: u8, + pub gpu_vendor: u8, +} + +impl EcRequest for EcRequestGetGpuPcie { + fn command_id() -> EcCommands { + EcCommands::GetGpuPcie + } +} + #[repr(u8)] pub enum SetGpuSerialMagic { /// 7700S config magic value diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index afdaef0c..d77994c5 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -1000,6 +1000,20 @@ impl CrosEc { println!(" Serial Number: Unknown"); } + let res = EcRequestGetGpuPcie {}.send_command(self)?; + let config: Option = FromPrimitive::from_u8(res.gpu_pcie_config); + let vendor: Option = FromPrimitive::from_u8(res.gpu_vendor); + if let Some(config) = config { + println!(" Config: {:?}", config); + } else { + println!(" Config: Unknown ({})", res.gpu_pcie_config); + } + if let Some(vendor) = vendor { + println!(" Vendor: {:?}", vendor); + } else { + println!(" Vendor: Unknown ({})", res.gpu_vendor); + } + Ok(()) }