@@ -76,28 +76,45 @@ Summary:
7676
7777### Check PD state
7878
79- Example on Framework Laptop 13 AMD Ryzen AI 300
79+ Example on Framework Laptop 13 (CCG8 CFP). The right controller is currently
80+ running the backup firmware, which supports fewer HPI features than the main
81+ firmware.
8082
8183```
82- > sudo framework_tool.exe --pd-info
84+ > sudo framework_tool --pd-info
8385Right / Ports 01
84- Silicon ID: 0x3580
85- Mode: MainFw
86+ Silicon ID: 0x3E81
87+ Mode: BackupFw
8688 Flash Row Size: 256 B
8789 Ports Enabled: 0, 1
88- Bootloader Version: Base: 3.6.0.009, App: 0.0.01
89- FW1 (Backup) Version: Base: 3.7.0.197, App: 0.0.0B
90- FW2 (Main) Version: Base: 3.7.0.197, App: 0.0.0B
90+ HPI Version: 2.4 (0x04006124) cyacd2
91+ Boot Reason: 0x00 (Both firmwares valid)
92+ WDT Resets: 0
93+ Config Table: v2.0
94+ Flash Layout: Bootloader rows 0-1, FW1 from row 2, FW2 from row 103
95+ Bootloader Version: Base: 3.6.0.044, App: 0.0.01
96+ FW1 (Backup) Version: Base: 3.8.50.00A, App: 1.0.09
97+ FW2 (Main) Version: Base: 3.8.50.00A, App: 1.0.0A
9198Left / Ports 23
92- Silicon ID: 0x3580
99+ Silicon ID: 0x3E81
93100 Mode: MainFw
94101 Flash Row Size: 256 B
95102 Ports Enabled: 0, 1
96- Bootloader Version: Base: 3.6.0.009, App: 0.0.01
97- FW1 (Backup) Version: Base: 3.7.0.197, App: 0.0.0B
98- FW2 (Main) Version: Base: 3.7.0.197, App: 0.0.0B
103+ HPI Version: 2.4 (0x04237724) PD Commands, UCSI, EPR, cyacd2
104+ Boot Reason: 0x00 (Both firmwares valid)
105+ WDT Resets: 0
106+ Config Table: v2.0
107+ Flash Layout: Bootloader rows 0-1, FW1 from row 2, FW2 from row 103
108+ Bootloader Version: Base: 3.6.0.044, App: 0.0.01
109+ FW1 (Backup) Version: Base: 3.8.50.00A, App: 1.0.0A
110+ FW2 (Main) Version: Base: 3.8.50.00A, App: 1.0.0A
99111```
100112
113+ The HPI Version, Boot Reason, WDT Resets, Config Table and Flash Layout lines
114+ are only shown if the PD firmware implements those registers. Boot Reason is
115+ only updated when the controller boots, it does not reflect firmware updates
116+ done since.
117+
101118### Disable/enable/reset PD
102119
103120```
@@ -281,6 +298,141 @@ This command has not been thoroughly tested on all Framework Computer systems
281298> framework_tool --reboot-ec jump-rw
282299```
283300
301+ ## Flashing PD firmware
302+
303+ ** IMPORTANT** Flashing PD firmware yourself is not recommended. Please update
304+ your firmware using the official BIOS update methods (Windows .exe,
305+ LVFS/FWUPD, EFI updater)!
306+
307+ The PD controllers hold two copies of the firmware, FW1 (backup) and FW2
308+ (main). Each firmware can only update the other one, so to update both the
309+ tool writes the inactive image, switches the controller to it, writes the other
310+ image and finally resets the controller. Normally the main firmware is running
311+ and gets booted after the reset.
312+
313+ While the PD controller is being updated, the EC does not talk to it and the
314+ ports get disabled. Make sure the battery is present and charged.
315+
316+ Tested on Framework Laptop 13 (CCG8 CFP).
317+
318+ ### Check the firmware on the controller against a file
319+
320+ Runs the same checks as flashing without writing anything, asks the controller
321+ to validate both images and compares the inactive image with the file.
322+
323+ ```
324+ > sudo framework_tool --validate-pd01 framework_lib/test_bins/sakura-pd-1.0.0A.bin
325+ Device
326+ Silicon ID: 0x3E81
327+ Mode: MainFw
328+ Flash Row Size: 256 B
329+ Backup FW: 1.0.0A
330+ Main FW: 1.0.0A
331+ File
332+ Silicon ID: 0x3E81 (Ccg8Cfp)
333+ Backup FW: 1.0.0A (rows 2-101)
334+ Main FW: 1.0.0A (rows 103-416)
335+ Validating firmware on the controller
336+ Firmware file layout matches the controller
337+ Main FW (FW2) Valid: true
338+ Backup FW (FW1) Valid: true
339+ Comparing Backup FW (FW1) on the controller with the file
340+ Row 1/100
341+ Row 33/100
342+ Row 65/100
343+ Row 97/100
344+ Row 100/100
345+ Backup FW (FW1) on the controller is identical to the file
346+ ```
347+
348+ If the file is not what is on the controller, the command fails:
349+
350+ ```
351+ > sudo framework_tool --validate-pd01 Compal_Sakura_8229_PD1_0x5253_v0.0.02.bin
352+ [...]
353+ Backup FW (FW1) on the controller differs from the file in 84 of 99 rows
354+ Failed to validate PD 01: DeviceError("Firmware on the controller does not match the file")
355+ Error: "Fail"
356+ ```
357+
358+ ### Flash
359+
360+ By default both images are updated. With ` --pd-image main ` or
361+ ` --pd-image backup ` only one of them is written. If the selected image is the
362+ one currently running, the controller is switched to the other one first.
363+
364+ ```
365+ # Only update the backup firmware on PD 0 (right side)
366+ > sudo framework_tool --flash-pd01 pd-1.0.09.bin --pd-image backup
367+ Device
368+ Silicon ID: 0x3E81
369+ Mode: MainFw
370+ Flash Row Size: 256 B
371+ Backup FW: 1.0.0A
372+ Main FW: 1.0.0A
373+ File
374+ Silicon ID: 0x3E81 (Ccg8Cfp)
375+ Backup FW: 1.0.09 (rows 2-101)
376+ Main FW: 1.0.09 (rows 103-416)
377+
378+ Flashing BackupFw (1.0.09) from MainFw
379+ Writing rows 2 to 101 (100 rows)
380+ Row 1/100
381+ Row 33/100
382+ Row 65/100
383+ Row 97/100
384+ Row 100/100
385+ Controller validated BackupFw: true
386+
387+ Restarting controller
388+ Resetting PD controller Right01
389+ Controller is running MainFw
390+ Bootloader Version: Base: 3.6.0.044, App: 0.0.01
391+ FW1 (Backup) Version: Base: 3.8.50.00A, App: 1.0.09
392+ FW2 (Main) Version: Base: 3.8.50.00A, App: 1.0.0A
393+
394+ # Update both images on PD 1 (left side)
395+ > sudo framework_tool --flash-pd23 pd-1.0.09.bin
396+ ```
397+
398+ ### Switch between the firmwares
399+
400+ For debugging it is possible to boot the other firmware copy. The switch lasts
401+ until the next reset of the PD controller, then the main firmware is booted
402+ again (if it is valid).
403+
404+ ```
405+ > sudo framework_tool --pd-jump-backup 0
406+ Jumping PD 0 to backup firmware...
407+ Current mode: MainFw, jumping to BackupFw
408+ Disabling PD ports
409+ Jumping from MainFw to BackupFw
410+ Now running BackupFw
411+
412+ > sudo framework_tool --pd-jump-main 0
413+ Jumping PD 0 to main firmware...
414+ Current mode: BackupFw, jumping to MainFw
415+ Disabling PD ports
416+ Jumping from BackupFw to MainFw
417+ Now running MainFw
418+
419+ # A reset also boots the main firmware again
420+ > sudo framework_tool --pd-reset 0
421+ Resetting PD 0...
422+ Disabling PD ports
423+ Resetting PD controller Right01
424+ Controller is running MainFw
425+ ```
426+
427+ ### Dump the flash
428+
429+ The controller only allows reading the inactive firmware image. The rows of
430+ the bootloader and the running firmware are filled with zeros.
431+
432+ ```
433+ > sudo framework_tool --pd-dump-fw 0:pd0-dump.bin
434+ ```
435+
284436## Flashing Expansion Bay EEPROM (Framework Laptop 16)
285437
286438This will render your dGPU unsuable if you flash the wrong file!
0 commit comments