Skip to content

--expansion-bay: Print PCIe config #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions framework_lib/src/chromium_ec/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
37 changes: 37 additions & 0 deletions framework_lib/src/chromium_ec/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,43 @@ impl EcRequest<EcResponseGetGpuSerial> 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<EcResponseGetGpuPcie> for EcRequestGetGpuPcie {
fn command_id() -> EcCommands {
EcCommands::GetGpuPcie
}
}

#[repr(u8)]
pub enum SetGpuSerialMagic {
/// 7700S config magic value
Expand Down
14 changes: 14 additions & 0 deletions framework_lib/src/chromium_ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,20 @@ impl CrosEc {
println!(" Serial Number: Unknown");
}

let res = EcRequestGetGpuPcie {}.send_command(self)?;
let config: Option<GpuPcieConfig> = FromPrimitive::from_u8(res.gpu_pcie_config);
let vendor: Option<GpuVendor> = 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(())
}

Expand Down
Loading