From 76c1d10281fc52f87f2a62b2fab827607b8f4f31 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 16:04:39 +0800 Subject: [PATCH 01/10] Add Framework13AmdAi300 Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/device.rs | 24 ++++++++++++++++++++---- framework_lib/src/chromium_ec/mod.rs | 6 +++++- framework_lib/src/power.rs | 6 +++--- framework_lib/src/smbios.rs | 7 ++++--- framework_lib/src/util.rs | 10 ++++++---- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/framework_lib/src/ccgx/device.rs b/framework_lib/src/ccgx/device.rs index 432db3b6..0c123086 100644 --- a/framework_lib/src/ccgx/device.rs +++ b/framework_lib/src/ccgx/device.rs @@ -44,8 +44,18 @@ impl PdPort { (Platform::GenericFramework((left, _), _, _), PdPort::Left01) => *left, (Platform::GenericFramework((_, right), _, _), PdPort::Right23) => *right, // Framework AMD Platforms (CCG8) - (Platform::Framework13Amd | Platform::Framework16, PdPort::Left01) => 0x42, - (Platform::Framework13Amd | Platform::Framework16, PdPort::Right23) => 0x40, + ( + Platform::Framework13Amd7080 + | Platform::Framework13AmdAi300 + | Platform::Framework16Amd7080, + PdPort::Left01, + ) => 0x42, + ( + Platform::Framework13Amd7080 + | Platform::Framework13AmdAi300 + | Platform::Framework16Amd7080, + PdPort::Right23, + ) => 0x40, // Framework Intel Platforms (CCG5 and CCG6) (_, PdPort::Left01) => 0x08, (_, PdPort::Right23) => 0x40, @@ -64,11 +74,17 @@ impl PdPort { (Platform::IntelGen12 | Platform::IntelGen13, PdPort::Left01) => 6, (Platform::IntelGen12 | Platform::IntelGen13, PdPort::Right23) => 7, ( - Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1, + Platform::Framework13Amd7080 + | Platform::Framework16Amd7080 + | Platform::IntelCoreUltra1 + | Platform::Framework13AmdAi300 PdPort::Left01, ) => 1, ( - Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1, + Platform::Framework13Amd7080 + | Platform::Framework16Amd7080 + | Platform::IntelCoreUltra1 + | Platform::Framework13AmdAi300 PdPort::Right23, ) => 2, // (_, _) => Err(EcError::DeviceError(format!( diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index f86fa839..4a83b9d5 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -125,9 +125,13 @@ pub fn has_mec() -> bool { return has_mec; } + // TODO: Should turn this around !matches!( smbios::get_platform().unwrap(), - Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1 + Platform::Framework13Amd7080 + | Platform::Framework16Amd7080 + | Platform::IntelCoreUltra1 + | Platform::Framework13AmdAi300 ) } diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 1f8835a7..c770ecd9 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -216,12 +216,12 @@ pub fn print_thermal(ec: &CrosEc) { println!(" PECI: {:>4}", TempSensor::from(temps[4])); println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5])); } - Some(Platform::Framework13Amd | Platform::Framework16) => { + Some(Platform::Framework13Amd7080 | Platform::Framework16Amd7080) => { println!(" F75303_Local: {:>4}", TempSensor::from(temps[0])); println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1])); println!(" F75303_DDR: {:>4}", TempSensor::from(temps[2])); println!(" APU: {:>4}", TempSensor::from(temps[3])); - if matches!(platform, Some(Platform::Framework16)) { + if matches!(platform, Some(Platform::Framework16Amd7080)) { println!(" dGPU VR: {:>4}", TempSensor::from(temps[4])); println!(" dGPU VRAM: {:>4}", TempSensor::from(temps[5])); println!(" dGPU AMB: {:>4}", TempSensor::from(temps[6])); @@ -495,7 +495,7 @@ pub fn get_pd_info(ec: &CrosEc, ports: u8) -> Vec> { } pub fn get_and_print_pd_info(ec: &CrosEc) { - let fl16 = Some(crate::util::Platform::Framework16) == get_platform(); + let fl16 = Some(crate::util::Platform::Framework16Amd7080) == get_platform(); let ports = 4; // All our platforms have 4 PD ports so far let infos = get_pd_info(ec, ports); for (port, info) in infos.iter().enumerate().take(ports.into()) { diff --git a/framework_lib/src/smbios.rs b/framework_lib/src/smbios.rs index 9c0ab1c7..aedd9cc7 100644 --- a/framework_lib/src/smbios.rs +++ b/framework_lib/src/smbios.rs @@ -262,10 +262,11 @@ pub fn get_platform() -> Option { "Laptop" => Some(Platform::IntelGen11), "Laptop (12th Gen Intel Core)" => Some(Platform::IntelGen12), "Laptop (13th Gen Intel Core)" => Some(Platform::IntelGen13), - "Laptop 13 (AMD Ryzen 7040Series)" => Some(Platform::Framework13Amd), - "Laptop 13 (AMD Ryzen 7040 Series)" => Some(Platform::Framework13Amd), + "Laptop 13 (AMD Ryzen 7040Series)" => Some(Platform::Framework13Amd7080), + "Laptop 13 (AMD Ryzen 7040 Series)" => Some(Platform::Framework13Amd7080), + "Laptop 13 (AMD Ryzen AI 300 Series)" => Some(Platform::Framework13AmdAi300), "Laptop 13 (Intel Core Ultra Series 1)" => Some(Platform::IntelCoreUltra1), - "Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16), + "Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16Amd7080), _ => None, }; diff --git a/framework_lib/src/util.rs b/framework_lib/src/util.rs index 18a5a577..a66b5f20 100644 --- a/framework_lib/src/util.rs +++ b/framework_lib/src/util.rs @@ -25,10 +25,12 @@ pub enum Platform { IntelGen13, /// Framework 13 - Intel Core Ultra Series 1, Codenamed MeteorLake IntelCoreUltra1, - /// Framework 13 - AMD Ryzen - Framework13Amd, - /// Framework 16 - Framework16, + /// Framework 13 - AMD Ryzen 7080 Series + Framework13Amd7080, + /// Framework 13 - AMD Ryzen AI 300 Series + Framework13AmdAi300, + /// Framework 16 - AMD Ryzen 7080 Series + Framework16Amd7080, /// Generic Framework device /// pd_addrs, pd_ports, has_mec GenericFramework((u16, u16), (u8, u8), bool), From df56687e49739e81826ca08fa558d449f29713b6 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 16:09:33 +0800 Subject: [PATCH 02/10] Add FrameworkDesktopAmdAiMax300 Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/device.rs | 4 ++++ framework_lib/src/chromium_ec/mod.rs | 1 + framework_lib/src/smbios.rs | 1 + framework_lib/src/util.rs | 2 ++ 4 files changed, 8 insertions(+) diff --git a/framework_lib/src/ccgx/device.rs b/framework_lib/src/ccgx/device.rs index 0c123086..cb083cd9 100644 --- a/framework_lib/src/ccgx/device.rs +++ b/framework_lib/src/ccgx/device.rs @@ -56,6 +56,8 @@ impl PdPort { | Platform::Framework16Amd7080, PdPort::Right23, ) => 0x40, + // TODO: It only has a single PD controller + (Platform::FrameworkDesktopAmdAiMax300, _) => 0x08, // Framework Intel Platforms (CCG5 and CCG6) (_, PdPort::Left01) => 0x08, (_, PdPort::Right23) => 0x40, @@ -87,6 +89,8 @@ impl PdPort { | Platform::Framework13AmdAi300 PdPort::Right23, ) => 2, + // TODO: It only has a single PD controller + (Platform::FrameworkDesktopAmdAiMax300, _) => 1, // (_, _) => Err(EcError::DeviceError(format!( // "Unsupported platform: {:?} {:?}", // platform, self diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index 4a83b9d5..30718c3a 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -132,6 +132,7 @@ pub fn has_mec() -> bool { | Platform::Framework16Amd7080 | Platform::IntelCoreUltra1 | Platform::Framework13AmdAi300 + | Platform::FrameworkDesktopAmdAiMax300 ) } diff --git a/framework_lib/src/smbios.rs b/framework_lib/src/smbios.rs index aedd9cc7..1c1b27ea 100644 --- a/framework_lib/src/smbios.rs +++ b/framework_lib/src/smbios.rs @@ -267,6 +267,7 @@ pub fn get_platform() -> Option { "Laptop 13 (AMD Ryzen AI 300 Series)" => Some(Platform::Framework13AmdAi300), "Laptop 13 (Intel Core Ultra Series 1)" => Some(Platform::IntelCoreUltra1), "Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16Amd7080), + "Desktop (AMD Ryzen AI Max 300 Series)" => Some(Platform::FrameworkDesktopAmdAiMax300), _ => None, }; diff --git a/framework_lib/src/util.rs b/framework_lib/src/util.rs index a66b5f20..513ccc00 100644 --- a/framework_lib/src/util.rs +++ b/framework_lib/src/util.rs @@ -31,6 +31,8 @@ pub enum Platform { Framework13AmdAi300, /// Framework 16 - AMD Ryzen 7080 Series Framework16Amd7080, + /// Framework Desktop - AMD Ryzen AI Max 300 + FrameworkDesktopAmdAiMax300, /// Generic Framework device /// pd_addrs, pd_ports, has_mec GenericFramework((u16, u16), (u8, u8), bool), From 428fc824a6413146c0ef051def43a80f8cd47160 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 16:10:07 +0800 Subject: [PATCH 03/10] Add Framework12IntelGen13 Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/device.rs | 2 ++ framework_lib/src/chromium_ec/mod.rs | 1 + framework_lib/src/smbios.rs | 1 + framework_lib/src/util.rs | 2 ++ 4 files changed, 6 insertions(+) diff --git a/framework_lib/src/ccgx/device.rs b/framework_lib/src/ccgx/device.rs index cb083cd9..aa1af5d0 100644 --- a/framework_lib/src/ccgx/device.rs +++ b/framework_lib/src/ccgx/device.rs @@ -80,6 +80,7 @@ impl PdPort { | Platform::Framework16Amd7080 | Platform::IntelCoreUltra1 | Platform::Framework13AmdAi300 + | Platform::Framework12IntelGen13, PdPort::Left01, ) => 1, ( @@ -87,6 +88,7 @@ impl PdPort { | Platform::Framework16Amd7080 | Platform::IntelCoreUltra1 | Platform::Framework13AmdAi300 + | Platform::Framework12IntelGen13, PdPort::Right23, ) => 2, // TODO: It only has a single PD controller diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index 30718c3a..ece6a5fe 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -132,6 +132,7 @@ pub fn has_mec() -> bool { | Platform::Framework16Amd7080 | Platform::IntelCoreUltra1 | Platform::Framework13AmdAi300 + | Platform::Framework12IntelGen13 | Platform::FrameworkDesktopAmdAiMax300 ) } diff --git a/framework_lib/src/smbios.rs b/framework_lib/src/smbios.rs index 1c1b27ea..fa23c2fa 100644 --- a/framework_lib/src/smbios.rs +++ b/framework_lib/src/smbios.rs @@ -265,6 +265,7 @@ pub fn get_platform() -> Option { "Laptop 13 (AMD Ryzen 7040Series)" => Some(Platform::Framework13Amd7080), "Laptop 13 (AMD Ryzen 7040 Series)" => Some(Platform::Framework13Amd7080), "Laptop 13 (AMD Ryzen AI 300 Series)" => Some(Platform::Framework13AmdAi300), + "Laptop 12 (13th Gen Intel Core)" => Some(Platform::Framework12IntelGen13), "Laptop 13 (Intel Core Ultra Series 1)" => Some(Platform::IntelCoreUltra1), "Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16Amd7080), "Desktop (AMD Ryzen AI Max 300 Series)" => Some(Platform::FrameworkDesktopAmdAiMax300), diff --git a/framework_lib/src/util.rs b/framework_lib/src/util.rs index 513ccc00..3fa8f505 100644 --- a/framework_lib/src/util.rs +++ b/framework_lib/src/util.rs @@ -17,6 +17,8 @@ use crate::smbios; #[derive(Debug, PartialEq, Clone, Copy)] pub enum Platform { + /// Framework 12 + Framework12IntelGen13, /// Framework 13 - Intel 11th Gen, Codenamed TigerLake IntelGen11, /// Framework 13 - Intel 11th Gen, Codenamed AlderLake From d4c0548ab2159214ec19e8585c0843ce246ce62d Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:10:00 +0800 Subject: [PATCH 04/10] power: No VCCGT temp sensor on gen11 Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index c770ecd9..47c62efb 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -214,7 +214,12 @@ pub fn print_thermal(ec: &CrosEc) { println!(" F75303_DDR: {:>4}", TempSensor::from(temps[2])); println!(" Battery: {:>4}", TempSensor::from(temps[3])); println!(" PECI: {:>4}", TempSensor::from(temps[4])); - println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5])); + if matches!( + platform, + Some(Platform::IntelGen12) | Some(Platform::IntelGen13) + ) { + println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5])); + } } Some(Platform::Framework13Amd7080 | Platform::Framework16Amd7080) => { println!(" F75303_Local: {:>4}", TempSensor::from(temps[0])); From 5a9118d5e47ae1cf527ca7af073e0266492bfbe5 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:11:00 +0800 Subject: [PATCH 05/10] power: Add core ultra temp mapping Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 47c62efb..08aae220 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -221,6 +221,15 @@ pub fn print_thermal(ec: &CrosEc) { println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5])); } } + + Some(Platform::IntelCoreUltra1) => { + println!(" F75303_Local: {:>4}", TempSensor::from(temps[0])); + println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1])); + println!(" Battery: {:>4}", TempSensor::from(temps[2])); + println!(" F75303_DDR: {:>4}", TempSensor::from(temps[3])); + println!(" PECI: {:>4}", TempSensor::from(temps[4])); + } + Some(Platform::Framework13Amd7080 | Platform::Framework16Amd7080) => { println!(" F75303_Local: {:>4}", TempSensor::from(temps[0])); println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1])); From 375625ac22faa239b6478225327f73adbca11867 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:11:42 +0800 Subject: [PATCH 06/10] thermal: Add Framework13AmdAi300 thermal mapping Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 08aae220..eced1c07 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -230,7 +230,11 @@ pub fn print_thermal(ec: &CrosEc) { println!(" PECI: {:>4}", TempSensor::from(temps[4])); } - Some(Platform::Framework13Amd7080 | Platform::Framework16Amd7080) => { + Some( + Platform::Framework13Amd7080 + | Platform::Framework13AmdAi300 + | Platform::Framework16Amd7080, + ) => { println!(" F75303_Local: {:>4}", TempSensor::from(temps[0])); println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1])); println!(" F75303_DDR: {:>4}", TempSensor::from(temps[2])); From bdf377bc13ed790a5d9be7bcfbdfcb756b547bbc Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:12:02 +0800 Subject: [PATCH 07/10] power: Add FrameworkDesktopAmdAiMax300 thermal mapping Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index eced1c07..8e6c6fb9 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -246,6 +246,14 @@ pub fn print_thermal(ec: &CrosEc) { println!(" dGPU temp: {:>4}", TempSensor::from(temps[7])); } } + + Some(Platform::FrameworkDesktopAmdAiMax300) => { + println!(" F75303_APU: {:>4}", TempSensor::from(temps[0])); + println!(" F75303_DDR: {:>4}", TempSensor::from(temps[1])); + println!(" F75303_AMB: {:>4}", TempSensor::from(temps[2])); + println!(" APU: {:>4}", TempSensor::from(temps[3])); + } + _ => { println!(" Temp 0: {:>4}", TempSensor::from(temps[0])); println!(" Temp 1: {:>4}", TempSensor::from(temps[1])); From edff45a41caba289cc13430b64003608fbb5cc0d Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:12:13 +0800 Subject: [PATCH 08/10] power: Add Framework12IntelGen13 thermal mapping Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 8e6c6fb9..b8477f63 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -230,6 +230,14 @@ pub fn print_thermal(ec: &CrosEc) { println!(" PECI: {:>4}", TempSensor::from(temps[4])); } + Some(Platform::Framework12IntelGen13) => { + println!(" F75303_CPU: {:>4}", TempSensor::from(temps[0])); + println!(" F75303_Skin: {:>4}", TempSensor::from(temps[1])); + println!(" F75303_Local: {:>4}", TempSensor::from(temps[2])); + println!(" Battery: {:>4}", TempSensor::from(temps[3])); + println!(" PECI: {:>4}", TempSensor::from(temps[4])); + } + Some( Platform::Framework13Amd7080 | Platform::Framework13AmdAi300 From a2e4dd323f44234986a872743a7d625ae92056df Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 17:28:59 +0800 Subject: [PATCH 09/10] README: Update Signed-off-by: Daniel Schaefer --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f4927fc0..1c454543 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,16 @@ All of these need EC communication support in order to work. ###### Communication with Embedded Controller +- [x] Framework Laptop 12 (Intel 13th Gen) - [x] Framework Laptop 13 (Intel 11-13th Gen) -- [x] Framework Laptop 13 (AMD Ryzen) -- [x] Framework Laptop 16 (AMD Ryzen) +- [x] Framework Laptop 13 (AMD Ryzen 7080) +- [x] Framework Laptop 13 (AMD Ryzen AI 300) +- [x] Framework Laptop 16 (AMD Ryzen 7080) +- [x] Framework Desktop (AMD Ryzen AI Max 300) - [x] Port I/O communication on Linux -- [x] Port I/O communication on UEFI +- [x] Port I/O communication in UEFI - [x] Using `cros_ec` driver in Linux kernel +- [x] Using [Framework EC Windows driver](https://github.com/FrameworkComputer/crosecbus) based on [coolstar's](https://github.com/coolstar/crosecbus) - [x] Using [DHowett's Windows CrosEC driver](https://github.com/DHowett/FrameworkWindowsUtils) ## Prerequisites @@ -99,8 +103,8 @@ will install the right toolchain and version for this project. MSRV (Minimum Supported Rust Version): -- 1.61 for Linux/Windows -- 1.68 for UEFI +- 1.74 for Linux/Windows +- 1.74 for UEFI ```sh # Running linter @@ -131,10 +135,6 @@ ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi Building on Windows or in general with fewer features: ```ps1 -# Because we're fetching a private dependency from git, it might be necessary -# to force cargo to use the git commandline. In powershell run: -$env:CARGO_NET_GIT_FETCH_WITH_CLI='true' - # Build the library and tool cargo build --no-default-features --features "windows" From a7e4d15771d87b9906475e9270132b5725126c55 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 26 Feb 2025 10:45:33 +0800 Subject: [PATCH 10/10] Specify C-ABI when packing Clippy now warns about this: error: item uses `packed` representation without ABI-qualification Quote from clippy: > repr(packed) by default implies repr(Rust, packed). However, this > representation is not stable, which makes it less useful: the bulk of > repr(packed) use cases are for interfacing with certain binary formats > (where it needs to be repr(C, packed)) and for zero-copy deserialization > (which needs to be stable). The best use case for repr(Rust, packed) is > for reducing binary size Signed-off-by: Daniel Schaefer --- framework_lib/src/audio_card.rs | 4 ++-- framework_lib/src/ccgx/binary.rs | 2 +- framework_lib/src/ccgx/hid.rs | 2 +- framework_lib/src/ccgx/mod.rs | 4 ++-- framework_lib/src/esrt/mod.rs | 2 +- framework_lib/src/smbios.rs | 2 +- framework_lib/src/uefi/mod.rs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/framework_lib/src/audio_card.rs b/framework_lib/src/audio_card.rs index 8647791d..3baa33ca 100644 --- a/framework_lib/src/audio_card.rs +++ b/framework_lib/src/audio_card.rs @@ -15,7 +15,7 @@ enum CapeCommand { GetVersion = 0x0103, } -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy)] struct CapeMessage { _len: i16, @@ -25,7 +25,7 @@ struct CapeMessage { data: [u32; CAPE_DATA_LEN], } -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy)] struct HidCapeMessage { _report_id: u16, diff --git a/framework_lib/src/ccgx/binary.rs b/framework_lib/src/ccgx/binary.rs index 30d7b33d..acb9c51a 100644 --- a/framework_lib/src/ccgx/binary.rs +++ b/framework_lib/src/ccgx/binary.rs @@ -44,7 +44,7 @@ const FW_VERSION_OFFSET: usize = 0xE0; const SMALL_ROW: usize = 0x80; const LARGE_ROW: usize = 0x100; -#[repr(packed)] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] struct VersionInfo { base_version: u32, diff --git a/framework_lib/src/ccgx/hid.rs b/framework_lib/src/ccgx/hid.rs index cc46111b..e3e14dc0 100644 --- a/framework_lib/src/ccgx/hid.rs +++ b/framework_lib/src/ccgx/hid.rs @@ -25,7 +25,7 @@ const FW2_START: usize = 0x0200; const FW1_METADATA: usize = 0x03FF; const FW2_METADATA: usize = 0x03FE; -#[repr(packed)] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] struct HidFirmwareInfo { report_id: u8, diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index 8c8f89d2..80b1b763 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -30,7 +30,7 @@ const CCG3_METADATA_OFFSET: usize = 0x40; const METADATA_MAGIC: u16 = u16::from_le_bytes([b'Y', b'C']); // CY (Cypress) const CCG8_METADATA_MAGIC: u16 = u16::from_le_bytes([b'F', b'I']); // IF (Infineon) -#[repr(packed)] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] struct CyAcdMetadata { /// Offset 00: Single Byte FW Checksum @@ -64,7 +64,7 @@ struct CyAcdMetadata { } // TODO: Would be nice to check the checksums -#[repr(packed)] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] struct CyAcd2Metadata { /// Offset 00: App Firmware Start diff --git a/framework_lib/src/esrt/mod.rs b/framework_lib/src/esrt/mod.rs index 521c6352..feb98a2a 100644 --- a/framework_lib/src/esrt/mod.rs +++ b/framework_lib/src/esrt/mod.rs @@ -144,7 +144,7 @@ pub fn match_guid_kind(guid: &Guid) -> FrameworkGuidKind { } } -#[repr(packed)] +#[repr(C, packed)] struct _Esrt { resource_count: u32, resource_count_max: u32, diff --git a/framework_lib/src/smbios.rs b/framework_lib/src/smbios.rs index fa23c2fa..58a383b8 100644 --- a/framework_lib/src/smbios.rs +++ b/framework_lib/src/smbios.rs @@ -106,7 +106,7 @@ pub struct Smbios3 { } #[cfg(target_os = "freebsd")] -#[repr(packed)] +#[repr(C, packed)] pub struct Smbios { pub anchor: [u8; 4], pub checksum: u8, diff --git a/framework_lib/src/uefi/mod.rs b/framework_lib/src/uefi/mod.rs index 2d6ec747..71d85b44 100644 --- a/framework_lib/src/uefi/mod.rs +++ b/framework_lib/src/uefi/mod.rs @@ -99,7 +99,7 @@ pub fn enable_page_break() { } } -#[repr(packed)] +#[repr(C, packed)] pub struct Smbios { pub anchor: [u8; 4], pub checksum: u8,