Skip to content

Commit d58a758

Browse files
Merge pull request #81 from FrameworkComputer/feb25
Add support for Framework 2nd Gen Event platforms
2 parents 6cc151a + a7e4d15 commit d58a758

File tree

12 files changed

+105
-34
lines changed

12 files changed

+105
-34
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ All of these need EC communication support in order to work.
8282

8383
###### Communication with Embedded Controller
8484

85+
- [x] Framework Laptop 12 (Intel 13th Gen)
8586
- [x] Framework Laptop 13 (Intel 11-13th Gen)
86-
- [x] Framework Laptop 13 (AMD Ryzen)
87-
- [x] Framework Laptop 16 (AMD Ryzen)
87+
- [x] Framework Laptop 13 (AMD Ryzen 7080)
88+
- [x] Framework Laptop 13 (AMD Ryzen AI 300)
89+
- [x] Framework Laptop 16 (AMD Ryzen 7080)
90+
- [x] Framework Desktop (AMD Ryzen AI Max 300)
8891
- [x] Port I/O communication on Linux
89-
- [x] Port I/O communication on UEFI
92+
- [x] Port I/O communication in UEFI
9093
- [x] Using `cros_ec` driver in Linux kernel
94+
- [x] Using [Framework EC Windows driver](https://github.com/FrameworkComputer/crosecbus) based on [coolstar's](https://github.com/coolstar/crosecbus)
9195
- [x] Using [DHowett's Windows CrosEC driver](https://github.com/DHowett/FrameworkWindowsUtils)
9296

9397
## Prerequisites
@@ -99,8 +103,8 @@ will install the right toolchain and version for this project.
99103

100104
MSRV (Minimum Supported Rust Version):
101105

102-
- 1.61 for Linux/Windows
103-
- 1.68 for UEFI
106+
- 1.74 for Linux/Windows
107+
- 1.74 for UEFI
104108

105109
```sh
106110
# Running linter
@@ -131,10 +135,6 @@ ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi
131135
Building on Windows or in general with fewer features:
132136

133137
```ps1
134-
# Because we're fetching a private dependency from git, it might be necessary
135-
# to force cargo to use the git commandline. In powershell run:
136-
$env:CARGO_NET_GIT_FETCH_WITH_CLI='true'
137-
138138
# Build the library and tool
139139
cargo build --no-default-features --features "windows"
140140

framework_lib/src/audio_card.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum CapeCommand {
1515
GetVersion = 0x0103,
1616
}
1717

18-
#[repr(packed)]
18+
#[repr(C, packed)]
1919
#[derive(Clone, Copy)]
2020
struct CapeMessage {
2121
_len: i16,
@@ -25,7 +25,7 @@ struct CapeMessage {
2525
data: [u32; CAPE_DATA_LEN],
2626
}
2727

28-
#[repr(packed)]
28+
#[repr(C, packed)]
2929
#[derive(Clone, Copy)]
3030
struct HidCapeMessage {
3131
_report_id: u16,

framework_lib/src/ccgx/binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const FW_VERSION_OFFSET: usize = 0xE0;
4444
const SMALL_ROW: usize = 0x80;
4545
const LARGE_ROW: usize = 0x100;
4646

47-
#[repr(packed)]
47+
#[repr(C, packed)]
4848
#[derive(Debug, Copy, Clone)]
4949
struct VersionInfo {
5050
base_version: u32,

framework_lib/src/ccgx/device.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,20 @@ impl PdPort {
4444
(Platform::GenericFramework((left, _), _, _), PdPort::Left01) => *left,
4545
(Platform::GenericFramework((_, right), _, _), PdPort::Right23) => *right,
4646
// Framework AMD Platforms (CCG8)
47-
(Platform::Framework13Amd | Platform::Framework16, PdPort::Left01) => 0x42,
48-
(Platform::Framework13Amd | Platform::Framework16, PdPort::Right23) => 0x40,
47+
(
48+
Platform::Framework13Amd7080
49+
| Platform::Framework13AmdAi300
50+
| Platform::Framework16Amd7080,
51+
PdPort::Left01,
52+
) => 0x42,
53+
(
54+
Platform::Framework13Amd7080
55+
| Platform::Framework13AmdAi300
56+
| Platform::Framework16Amd7080,
57+
PdPort::Right23,
58+
) => 0x40,
59+
// TODO: It only has a single PD controller
60+
(Platform::FrameworkDesktopAmdAiMax300, _) => 0x08,
4961
// Framework Intel Platforms (CCG5 and CCG6)
5062
(_, PdPort::Left01) => 0x08,
5163
(_, PdPort::Right23) => 0x40,
@@ -64,13 +76,23 @@ impl PdPort {
6476
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Left01) => 6,
6577
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Right23) => 7,
6678
(
67-
Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1,
79+
Platform::Framework13Amd7080
80+
| Platform::Framework16Amd7080
81+
| Platform::IntelCoreUltra1
82+
| Platform::Framework13AmdAi300
83+
| Platform::Framework12IntelGen13,
6884
PdPort::Left01,
6985
) => 1,
7086
(
71-
Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1,
87+
Platform::Framework13Amd7080
88+
| Platform::Framework16Amd7080
89+
| Platform::IntelCoreUltra1
90+
| Platform::Framework13AmdAi300
91+
| Platform::Framework12IntelGen13,
7292
PdPort::Right23,
7393
) => 2,
94+
// TODO: It only has a single PD controller
95+
(Platform::FrameworkDesktopAmdAiMax300, _) => 1,
7496
// (_, _) => Err(EcError::DeviceError(format!(
7597
// "Unsupported platform: {:?} {:?}",
7698
// platform, self

framework_lib/src/ccgx/hid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const FW2_START: usize = 0x0200;
2525
const FW1_METADATA: usize = 0x03FF;
2626
const FW2_METADATA: usize = 0x03FE;
2727

28-
#[repr(packed)]
28+
#[repr(C, packed)]
2929
#[derive(Debug, Copy, Clone)]
3030
struct HidFirmwareInfo {
3131
report_id: u8,

framework_lib/src/ccgx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const CCG3_METADATA_OFFSET: usize = 0x40;
3030
const METADATA_MAGIC: u16 = u16::from_le_bytes([b'Y', b'C']); // CY (Cypress)
3131
const CCG8_METADATA_MAGIC: u16 = u16::from_le_bytes([b'F', b'I']); // IF (Infineon)
3232

33-
#[repr(packed)]
33+
#[repr(C, packed)]
3434
#[derive(Debug, Copy, Clone)]
3535
struct CyAcdMetadata {
3636
/// Offset 00: Single Byte FW Checksum
@@ -64,7 +64,7 @@ struct CyAcdMetadata {
6464
}
6565

6666
// TODO: Would be nice to check the checksums
67-
#[repr(packed)]
67+
#[repr(C, packed)]
6868
#[derive(Debug, Copy, Clone)]
6969
struct CyAcd2Metadata {
7070
/// Offset 00: App Firmware Start

framework_lib/src/chromium_ec/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,15 @@ pub fn has_mec() -> bool {
125125
return has_mec;
126126
}
127127

128+
// TODO: Should turn this around
128129
!matches!(
129130
smbios::get_platform().unwrap(),
130-
Platform::Framework13Amd | Platform::Framework16 | Platform::IntelCoreUltra1
131+
Platform::Framework13Amd7080
132+
| Platform::Framework16Amd7080
133+
| Platform::IntelCoreUltra1
134+
| Platform::Framework13AmdAi300
135+
| Platform::Framework12IntelGen13
136+
| Platform::FrameworkDesktopAmdAiMax300
131137
)
132138
}
133139

framework_lib/src/esrt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn match_guid_kind(guid: &Guid) -> FrameworkGuidKind {
144144
}
145145
}
146146

147-
#[repr(packed)]
147+
#[repr(C, packed)]
148148
struct _Esrt {
149149
resource_count: u32,
150150
resource_count_max: u32,

framework_lib/src/power.rs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,54 @@ pub fn print_thermal(ec: &CrosEc) {
214214
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[2]));
215215
println!(" Battery: {:>4}", TempSensor::from(temps[3]));
216216
println!(" PECI: {:>4}", TempSensor::from(temps[4]));
217-
println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5]));
217+
if matches!(
218+
platform,
219+
Some(Platform::IntelGen12) | Some(Platform::IntelGen13)
220+
) {
221+
println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5]));
222+
}
218223
}
219-
Some(Platform::Framework13Amd | Platform::Framework16) => {
224+
225+
Some(Platform::IntelCoreUltra1) => {
226+
println!(" F75303_Local: {:>4}", TempSensor::from(temps[0]));
227+
println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1]));
228+
println!(" Battery: {:>4}", TempSensor::from(temps[2]));
229+
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[3]));
230+
println!(" PECI: {:>4}", TempSensor::from(temps[4]));
231+
}
232+
233+
Some(Platform::Framework12IntelGen13) => {
234+
println!(" F75303_CPU: {:>4}", TempSensor::from(temps[0]));
235+
println!(" F75303_Skin: {:>4}", TempSensor::from(temps[1]));
236+
println!(" F75303_Local: {:>4}", TempSensor::from(temps[2]));
237+
println!(" Battery: {:>4}", TempSensor::from(temps[3]));
238+
println!(" PECI: {:>4}", TempSensor::from(temps[4]));
239+
}
240+
241+
Some(
242+
Platform::Framework13Amd7080
243+
| Platform::Framework13AmdAi300
244+
| Platform::Framework16Amd7080,
245+
) => {
220246
println!(" F75303_Local: {:>4}", TempSensor::from(temps[0]));
221247
println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1]));
222248
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[2]));
223249
println!(" APU: {:>4}", TempSensor::from(temps[3]));
224-
if matches!(platform, Some(Platform::Framework16)) {
250+
if matches!(platform, Some(Platform::Framework16Amd7080)) {
225251
println!(" dGPU VR: {:>4}", TempSensor::from(temps[4]));
226252
println!(" dGPU VRAM: {:>4}", TempSensor::from(temps[5]));
227253
println!(" dGPU AMB: {:>4}", TempSensor::from(temps[6]));
228254
println!(" dGPU temp: {:>4}", TempSensor::from(temps[7]));
229255
}
230256
}
257+
258+
Some(Platform::FrameworkDesktopAmdAiMax300) => {
259+
println!(" F75303_APU: {:>4}", TempSensor::from(temps[0]));
260+
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[1]));
261+
println!(" F75303_AMB: {:>4}", TempSensor::from(temps[2]));
262+
println!(" APU: {:>4}", TempSensor::from(temps[3]));
263+
}
264+
231265
_ => {
232266
println!(" Temp 0: {:>4}", TempSensor::from(temps[0]));
233267
println!(" Temp 1: {:>4}", TempSensor::from(temps[1]));
@@ -495,7 +529,7 @@ pub fn get_pd_info(ec: &CrosEc, ports: u8) -> Vec<EcResult<UsbPdPowerInfo>> {
495529
}
496530

497531
pub fn get_and_print_pd_info(ec: &CrosEc) {
498-
let fl16 = Some(crate::util::Platform::Framework16) == get_platform();
532+
let fl16 = Some(crate::util::Platform::Framework16Amd7080) == get_platform();
499533
let ports = 4; // All our platforms have 4 PD ports so far
500534
let infos = get_pd_info(ec, ports);
501535
for (port, info) in infos.iter().enumerate().take(ports.into()) {

framework_lib/src/smbios.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub struct Smbios3 {
107107
}
108108

109109
#[cfg(target_os = "freebsd")]
110-
#[repr(packed)]
110+
#[repr(C, packed)]
111111
pub struct Smbios {
112112
pub anchor: [u8; 4],
113113
pub checksum: u8,
@@ -263,10 +263,13 @@ pub fn get_platform() -> Option<Platform> {
263263
"Laptop" => Some(Platform::IntelGen11),
264264
"Laptop (12th Gen Intel Core)" => Some(Platform::IntelGen12),
265265
"Laptop (13th Gen Intel Core)" => Some(Platform::IntelGen13),
266-
"Laptop 13 (AMD Ryzen 7040Series)" => Some(Platform::Framework13Amd),
267-
"Laptop 13 (AMD Ryzen 7040 Series)" => Some(Platform::Framework13Amd),
266+
"Laptop 13 (AMD Ryzen 7040Series)" => Some(Platform::Framework13Amd7080),
267+
"Laptop 13 (AMD Ryzen 7040 Series)" => Some(Platform::Framework13Amd7080),
268+
"Laptop 13 (AMD Ryzen AI 300 Series)" => Some(Platform::Framework13AmdAi300),
269+
"Laptop 12 (13th Gen Intel Core)" => Some(Platform::Framework12IntelGen13),
268270
"Laptop 13 (Intel Core Ultra Series 1)" => Some(Platform::IntelCoreUltra1),
269-
"Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16),
271+
"Laptop 16 (AMD Ryzen 7040 Series)" => Some(Platform::Framework16Amd7080),
272+
"Desktop (AMD Ryzen AI Max 300 Series)" => Some(Platform::FrameworkDesktopAmdAiMax300),
270273
_ => None,
271274
};
272275

framework_lib/src/uefi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn enable_page_break() {
9999
}
100100
}
101101

102-
#[repr(packed)]
102+
#[repr(C, packed)]
103103
pub struct Smbios {
104104
pub anchor: [u8; 4],
105105
pub checksum: u8,

framework_lib/src/util.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use crate::smbios;
1717

1818
#[derive(Debug, PartialEq, Clone, Copy)]
1919
pub enum Platform {
20+
/// Framework 12
21+
Framework12IntelGen13,
2022
/// Framework 13 - Intel 11th Gen, Codenamed TigerLake
2123
IntelGen11,
2224
/// Framework 13 - Intel 11th Gen, Codenamed AlderLake
@@ -25,10 +27,14 @@ pub enum Platform {
2527
IntelGen13,
2628
/// Framework 13 - Intel Core Ultra Series 1, Codenamed MeteorLake
2729
IntelCoreUltra1,
28-
/// Framework 13 - AMD Ryzen
29-
Framework13Amd,
30-
/// Framework 16
31-
Framework16,
30+
/// Framework 13 - AMD Ryzen 7080 Series
31+
Framework13Amd7080,
32+
/// Framework 13 - AMD Ryzen AI 300 Series
33+
Framework13AmdAi300,
34+
/// Framework 16 - AMD Ryzen 7080 Series
35+
Framework16Amd7080,
36+
/// Framework Desktop - AMD Ryzen AI Max 300
37+
FrameworkDesktopAmdAiMax300,
3238
/// Generic Framework device
3339
/// pd_addrs, pd_ports, has_mec
3440
GenericFramework((u16, u16), (u8, u8), bool),

0 commit comments

Comments
 (0)