@@ -169,8 +169,114 @@ fn in_c(t: u8) -> u8 {
169
169
}
170
170
}
171
171
172
+ pub fn print_expansion_bay_info ( ec : & CrosEc ) {
173
+ let platform = smbios:: get_platform ( ) ;
174
+ if !matches ! (
175
+ platform,
176
+ Some ( Platform :: Framework13Amd ) | Some ( Platform :: Framework16 )
177
+ ) {
178
+ println ! ( "Only applicable to Framework 16 and Framework AMD systems" ) ;
179
+ return ;
180
+ }
181
+
182
+ println ! ( "AMD" ) ;
183
+ // TODO: This is also on Azalea?
184
+ let power_slider = ec. read_memory ( 0x151 , 0x02 ) . unwrap ( ) [ 0 ] ;
185
+ let dc_ac = if power_slider <= 0b1000 { "DC" } else { "AC" } ;
186
+ let mode = match power_slider {
187
+ 0b0000_0001 | 0b0001_0000 => "Best Performance" ,
188
+ 0b0000_0010 | 0b0010_0000 => "Balanced" ,
189
+ 0b0000_0100 | 0b0100_0000 => "Best Power Efficiency" ,
190
+ 0b0000_1000 => "Battery Saver" ,
191
+ _ => "Unknown Mode" ,
192
+ } ;
193
+ println ! (
194
+ " Power Slider: {}, {} ({:#09b})" ,
195
+ dc_ac, mode, power_slider
196
+ ) ;
197
+
198
+ // TODO: This is also on Azalea?
199
+ let stt_table = ec. read_memory ( 0x154 , 0x01 ) . unwrap ( ) [ 0 ] ;
200
+ println ! ( " STT Table: {:?}" , stt_table) ;
201
+
202
+ // TODO: What's this? Always [0x00, 0x00] so far
203
+ // TODO: This is also on Azalea?
204
+ // Core Performance Boost
205
+ let cbp = ec. read_memory ( 0x155 , 0x02 ) . unwrap ( ) ;
206
+ println ! ( " CBP: {} ({:?})" , cbp == [ 0x00 , 0x00 ] , cbp) ;
207
+
208
+ // TODO: When is this changed?
209
+ // TODO: This is also on Azalea?
210
+ let dtt_temp = ec. read_memory ( 0x160 , 0x0F ) . unwrap ( ) ;
211
+ println ! ( " DTT Temp: {:?}" , dtt_temp) ;
212
+
213
+ if !matches ! ( platform, Some ( Platform :: Framework16 ) ) {
214
+ return ;
215
+ }
216
+
217
+ println ! ( "Expansion Bay" ) ;
218
+
219
+ // TODO: This is the serial struct in the Expansion Bay?
220
+ let serial_struct = ec. read_memory ( 0x140 , 0x04 ) . unwrap ( ) ;
221
+ println ! ( " Serial Struct: {:?}" , serial_struct) ;
222
+
223
+ // TODO: Why is this in the same namespace?
224
+ // let batt_manuf_day = ec.read_memory(0x144, 0x01).unwrap()[0];
225
+ // let batt_manuf_month = ec.read_memory(0x145, 0x01).unwrap()[0];
226
+ // let batt_manuf_year = ec.read_memory(0x146, 0x02).unwrap();
227
+ // let batt_manuf_year = u16::from_le_bytes([batt_manuf_year[0], batt_manuf_year[1]]);
228
+ // println!(" Batt Manuf {:?}-{:?}-{:?}", batt_manuf_year, batt_manuf_month, batt_manuf_day);
229
+
230
+ // TODO: This is the PD in the dGPU module?
231
+ let pd_ver = ec. read_memory ( 0x14C , 0x04 ) . unwrap ( ) ;
232
+ println ! ( " PD Version: {:?}" , pd_ver) ;
233
+
234
+ let gpu_ctrl = ec. read_memory ( 0x150 , 0x01 ) . unwrap ( ) [ 0 ] ;
235
+ // Unused, this is for the BIOS to set
236
+ let _set_mux_status = match gpu_ctrl & 0b11 {
237
+ 0b00 => "EC Received and Clear" ,
238
+ 0b01 => "BIOS Set APU" ,
239
+ 0b10 => "BIOS Set GPU" ,
240
+ _ => "Unknown" ,
241
+ } ;
242
+ let mux_status = if ( gpu_ctrl & 0b100 ) > 0 { "APU" } else { "GPU" } ;
243
+ let board_status = if ( gpu_ctrl & 0b1000 ) > 0 {
244
+ "Present"
245
+ } else {
246
+ "Absent"
247
+ } ;
248
+ // Unused, set by BIOS: (gpu_ctrl & 0b10000)
249
+ let pcie_config = match gpu_ctrl & 0b01100000 {
250
+ 0b00 => "8x1" ,
251
+ 0b01 => "4x1" ,
252
+ 0b10 => "4x2" ,
253
+ 0b11 => "Disabled" ,
254
+ _ => "Unknown" ,
255
+ } ;
256
+ println ! ( " GPU CTRL: {:#x}" , gpu_ctrl) ;
257
+ println ! ( " MUX Status: {}" , mux_status) ;
258
+ println ! ( " Board Status: {}" , board_status) ;
259
+ println ! ( " PCIe Config: {}" , pcie_config) ;
260
+
261
+ // TODO: This seems like it's not correctly working? It's always false
262
+ let display_on = ec. read_memory ( 0x153 , 0x01 ) . unwrap ( ) [ 0 ] ;
263
+ println ! ( " Display On: {:?}" , display_on == 0x01 ) ;
264
+
265
+ let gpu_type = ec. read_memory ( 0x157 , 0x01 ) . unwrap ( ) [ 0 ] ;
266
+ let gpu_name = match gpu_type {
267
+ 0x00 => "Initializing" ,
268
+ 0x01 => "Fan Only" ,
269
+ 0x02 => "AMD R23M" ,
270
+ 0x03 => "SSD" ,
271
+ 0x04 => "PCIe Accessory" ,
272
+ _ => "Unknown" ,
273
+ } ;
274
+ println ! ( " GPU Type: {} ({:?})" , gpu_name, gpu_type) ;
275
+ }
276
+
172
277
pub fn print_thermal ( ec : & CrosEc ) {
173
278
let temps = ec. read_memory ( EC_MEMMAP_TEMP_SENSOR , 0x0F ) . unwrap ( ) ;
279
+ println ! ( "Temps: {:?}" , temps) ;
174
280
let fans = ec. read_memory ( EC_MEMMAP_FAN , 0x08 ) . unwrap ( ) ;
175
281
176
282
let platform = smbios:: get_platform ( ) ;
@@ -184,10 +290,13 @@ pub fn print_thermal(ec: &CrosEc) {
184
290
println ! ( " F57397_VCCGT: {:>4} C" , in_c( temps[ 5 ] ) ) ;
185
291
}
186
292
Some ( Platform :: Framework13Amd | Platform :: Framework16 ) => {
187
- println ! ( " F75303_Local: {:>4} C" , in_c( temps[ 0 ] ) ) ;
188
- println ! ( " F75303_CPU: {:>4} C" , in_c( temps[ 1 ] ) ) ;
189
- println ! ( " F75303_DDR: {:>4} C" , in_c( temps[ 2 ] ) ) ;
190
- println ! ( " APU: {:>4} C" , in_c( temps[ 3 ] ) ) ;
293
+ // TODO: Check names. EC names are like this. But EC namespace spreadsheet is different
294
+ println ! ( " Ambient: {:>4} C" , in_c( temps[ 0 ] ) ) ;
295
+ println ! ( " Charger: {:>4} C" , in_c( temps[ 1 ] ) ) ;
296
+ println ! ( " APU: {:>4} C" , in_c( temps[ 2 ] ) ) ;
297
+ println ! ( " CPU: {:>4} C" , in_c( temps[ 3 ] ) ) ;
298
+ // TODO: Only display if dGPU is present
299
+ // TODO: Sometimes these show 0 even if the GPU is present. Why?
191
300
if matches ! ( platform, Some ( Platform :: Framework16 ) ) {
192
301
println ! ( " dGPU VR: {:>4} C" , in_c( temps[ 4 ] ) ) ;
193
302
println ! ( " dGPU VRAM: {:>4} C" , in_c( temps[ 5 ] ) ) ;
@@ -208,7 +317,13 @@ pub fn print_thermal(ec: &CrosEc) {
208
317
}
209
318
210
319
let fan0 = u16:: from_le_bytes ( [ fans[ 0 ] , fans[ 1 ] ] ) ;
211
- println ! ( " Fan Speed: {:>4} RPM" , fan0) ;
320
+ let fan1 = u16:: from_le_bytes ( [ fans[ 2 ] , fans[ 3 ] ] ) ;
321
+ if matches ! ( platform, Some ( Platform :: Framework16 ) ) {
322
+ println ! ( " Fan L Speed: {:>4} RPM" , fan0) ;
323
+ println ! ( " Fan R Speed: {:>4} RPM" , fan1) ;
324
+ } else {
325
+ println ! ( " Fan Speed: {:>4} RPM" , fan0) ;
326
+ }
212
327
}
213
328
214
329
// TODO: Use Result
0 commit comments