Skip to content

Commit 95cbdc3

Browse files
committed
ccgx: Extract CCG8 PD version from capsule
``` > framework_tool --ho2-capsule Framework_Laptop_13_Ryzen7040_capsule_signed_allsku_3.08.cap [...] Detected CCG8 firmware FW 1 Silicon ID: 0x11c5 Silicon Family: 0x3580 Version: 0.0.1C Base Ver: 3.7.0.0D0 Row size: 256 B Start Row: 290 Rows: 474 Size: 121444 B Size: 118 KB FW 2 Silicon ID: 0x11c5 Silicon Family: 0x3580 Version: 0.0.1C Base Ver: 3.7.0.0D0 Row size: 256 B Start Row: 29 Rows: 175 Size: 45024 B Size: 43 KB ``` Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 476a634 commit 95cbdc3

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ see the [Support Matrices](support-matrices.md).
3333
- [x] HO2 BIOS Capsule (`--ho2-capsule`)
3434
- [x] BIOS Version
3535
- [x] EC Version
36-
- [x] CCG5/CCG6 PD Version
36+
- [x] CCG5/CCG6/CCG8 PD Version
3737
- [x] UEFI Capsule (`--capsule`)
3838
- [x] Parse metadata from capsule binary
3939
- [x] Determine type (GUID) of capsule binary

framework_lib/src/capsule_content.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::alloc::string::ToString;
88
use alloc::string::String;
99
use core::convert::TryInto;
1010

11-
use crate::ccgx::binary::{CCG5_PD_LEN, CCG6_PD_LEN};
11+
use crate::ccgx::binary::{CCG5_PD_LEN, CCG6_PD_LEN, CCG8_PD_LEN};
1212
use crate::ec_binary::EC_LEN;
1313
use crate::util;
1414

@@ -57,10 +57,13 @@ pub fn find_pd_in_bios_cap(data: &[u8]) -> Option<&[u8]> {
5757
// they're the same version
5858
let ccg5_needle = &[0x00, 0x20, 0x00, 0x20, 0x11, 0x00];
5959
let ccg6_needle = &[0x00, 0x40, 0x00, 0x20, 0x11, 0x00];
60+
let ccg8_needle = &[0x00, 0x80, 0x00, 0x20, 0xAD, 0x0C];
6061
if let Some(found_pd1) = util::find_sequence(data, ccg5_needle) {
6162
Some(&data[found_pd1..found_pd1 + CCG5_PD_LEN])
6263
} else if let Some(found_pd1) = util::find_sequence(data, ccg6_needle) {
6364
Some(&data[found_pd1..found_pd1 + CCG6_PD_LEN])
65+
} else if let Some(found_pd1) = util::find_sequence(data, ccg8_needle) {
66+
Some(&data[found_pd1..found_pd1 + CCG8_PD_LEN])
6467
} else {
6568
None
6669
}

framework_lib/src/ccgx/binary.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ struct VersionInfo {
5353
silicon_family: u16,
5454
}
5555

56-
pub const CCG5_PD_LEN: usize = 0x2_0000;
57-
pub const CCG6_PD_LEN: usize = 0x2_0000;
56+
pub const CCG5_PD_LEN: usize = 0x20_000;
57+
pub const CCG6_PD_LEN: usize = 0x20_000;
58+
pub const CCG8_PD_LEN: usize = 0x40_000;
5859

5960
/// Information about all the firmware in a PD binary file
6061
///

framework_lib/src/commandline/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,10 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
957957
analyze_ec_fw(ec_bin);
958958
}
959959
if let Some(pd_bin) = find_pd_in_bios_cap(&data) {
960+
debug!("Found PD binary in BIOS capsule");
960961
analyze_ccgx_pd_fw(pd_bin);
962+
} else {
963+
debug!("Didn't find PD binary in BIOS capsule");
961964
}
962965
}
963966
} else if let Some(dump_path) = &args.dump_ec_flash {
@@ -1280,7 +1283,7 @@ fn analyze_ccgx_pd_fw(data: &[u8]) {
12801283
ccgx::binary::print_fw(&versions.main_fw);
12811284
return;
12821285
} else {
1283-
println!("Failed to read versions")
1286+
println!("Failed to read PD versions")
12841287
}
12851288
}
12861289

0 commit comments

Comments
 (0)