Skip to content

Commit 0b2658b

Browse files
committed
--expansion-bay: Print PCIe config
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent d515b02 commit 0b2658b

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

EXAMPLES.md

+2
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ Expansion Bay
225225
Door closed: true
226226
Board: DualInterposer
227227
Serial Number: FRAXXXXXXXXXXXXXXX
228+
Config: Pcie4x2
229+
Vendor: SsdHolder
228230
```
229231

230232
## Check charger and battery status (Framework 12/13/16)

framework_lib/src/chromium_ec/command.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub enum EcCommands {
9696
GetHwDiag = 0x3E1C,
9797
/// Get gpu bay serial
9898
GetGpuSerial = 0x3E1D,
99+
GetGpuPcie = 0x3E1E,
99100
/// Set gpu bay serial and program structure
100101
ProgramGpuEeprom = 0x3E1F,
101102
}

framework_lib/src/chromium_ec/commands.rs

+37
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,43 @@ impl EcRequest<EcResponseGetGpuSerial> for EcRequestGetGpuSerial {
11291129
}
11301130
}
11311131

1132+
#[repr(C, packed)]
1133+
pub struct EcRequestGetGpuPcie {}
1134+
1135+
#[repr(u8)]
1136+
#[derive(Debug, FromPrimitive)]
1137+
pub enum GpuPcieConfig {
1138+
/// PCIe 8x1
1139+
Pcie8x1 = 0,
1140+
/// PCIe 4x1
1141+
Pcie4x1 = 1,
1142+
/// PCIe 4x2
1143+
Pcie4x2 = 2,
1144+
}
1145+
1146+
#[repr(u8)]
1147+
#[derive(Debug, FromPrimitive)]
1148+
pub enum GpuVendor {
1149+
Initializing = 0x00,
1150+
FanOnly = 0x01,
1151+
GpuAmdR23M = 0x02,
1152+
SsdHolder = 0x03,
1153+
PcieAccessory = 0x4,
1154+
}
1155+
1156+
#[repr(C, packed)]
1157+
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
1158+
pub struct EcResponseGetGpuPcie {
1159+
pub gpu_pcie_config: u8,
1160+
pub gpu_vendor: u8,
1161+
}
1162+
1163+
impl EcRequest<EcResponseGetGpuPcie> for EcRequestGetGpuPcie {
1164+
fn command_id() -> EcCommands {
1165+
EcCommands::GetGpuPcie
1166+
}
1167+
}
1168+
11321169
#[repr(u8)]
11331170
pub enum SetGpuSerialMagic {
11341171
/// 7700S config magic value

framework_lib/src/chromium_ec/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,20 @@ impl CrosEc {
10001000
println!(" Serial Number: Unknown");
10011001
}
10021002

1003+
let res = EcRequestGetGpuPcie {}.send_command(self)?;
1004+
let config: Option<GpuPcieConfig> = FromPrimitive::from_u8(res.gpu_pcie_config);
1005+
let vendor: Option<GpuVendor> = FromPrimitive::from_u8(res.gpu_vendor);
1006+
if let Some(config) = config {
1007+
println!(" Config: {:?}", config);
1008+
} else {
1009+
println!(" Config: Unknown ({})", res.gpu_pcie_config);
1010+
}
1011+
if let Some(vendor) = vendor {
1012+
println!(" Vendor: {:?}", vendor);
1013+
} else {
1014+
println!(" Vendor: Unknown ({})", res.gpu_vendor);
1015+
}
1016+
10031017
Ok(())
10041018
}
10051019

0 commit comments

Comments
 (0)