EC capsules#922
Conversation
"payloads/external/edk2: configure capsule updates" should have been dropped when rebasing onto 2024.12, it introduces the duplicates. Change-Id: Ia9950f38eec002e979e491d648f1520fbdb39e74 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
…FW_* CONFIG_DRIVERS_EFI_EC_FW_GUID is a counterpart of CONFIG_DRIVERS_EFI_MAIN_FW_GUID but for EC. When empty (the default), implies absence of EC or a method of updates other than a dedicated capsule. The option's value is passed to EDK as CAPSULE_EC_FW_GUID macro. Requires EC_DASHARO_EC to be able to query EC's version. CONFIG_EC_DASHARO_EC_UPDATE now depends on CONFIG_DRIVERS_EFI_MAIN_FW_GUID being empty to avoid performing updates in two different ways. CONFIG_DRIVERS_EFI_EC_FW_LSV and CONFIG_DRIVERS_EFI_EC_FW_SIZE were added mostly for completeness to match the information that's published for the main firmware. They are exposed by coreboot as is and don't need to be filled. However, CONFIG_DRIVERS_EFI_EC_FW_SIZE may be useful to check that coreboot and EDK are in agreement about EC. Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Ia6054440af41069e797675a027fe7548fcb097e8 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
The version is queried from EC and date there is parsed into a 32-bit integer version (so two releases on the same day look identical). GUID, LSV and size come from Kconfig options. Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Icfa91b9d95b6a4d289a060fa4647b6e3c73a5e11 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: I92de68aa4714c849e5da7cc51a4359dafcfb368a Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Ibeaecdae26b9504b90837ff075a0ace6ee0ec3d3 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Use an array of drivers and avoid writing JSON file in chunks. Change-Id: If9f897460e661f3d6dcf2ca127a37702444118b2 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Pass all capsule-specific information in parameters. Change-Id: I6ec636c236e4074ba0115b4867be3c247717edfc Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: Ic7bdc0a2b84780ca8f76d6727b92126609dfd3d2 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
5d1c116 to
0905913
Compare
|
Some observations from initial testing:
|
Why not use the commit hash and be safe? In capsule updates Dasharo firmware is not being versioned by the date or commit SHA, but on a release basis, and we already do release tags on EC. Why not just use the Dasharo versioning scheme for EC too? |
In coreboot?
Auto-updating in coreboot is mutually exclusive with EC capsules.
Have you enabled EC capsules in config? I didn't update any of them since I don't yet know which models need to be enabled and in what release.
Commit hashes are pseudo-random and have no meaningful ordering defined for them, but date can be compared. Need ordering for fwupd and LSV.
I was adapting the version already in use to 32-bit unsigned values, don't know if we want to make EC firmware report different version when enabling capsule updates. |
The option results in the use of EC-specific Kconfig options. It also takes path to the EC file as its argument. Version of the ROM is derived from a string that the file contains (`76EC_VERSION=...`). There is an additional ROM size check and "_ec" infix between version, but otherwise the behaviour is identical to main firmware capsules. The paths to DXE's that are firmware-specific are updated to include GUID as there can be multiple instances now. Change-Id: I4a7037fdd686d8f703f812d5733973c58df8e9c3 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Mainly make it clear that the flag is optional. Change-Id: I88bb3c953c14f69ab6da7b99f80486ac22cb7a23 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
It suppresses confirmation prompt when the destination file exists, making using `capsule.sh` from scripts easier. Change-Id: Ib9539126c9923a27d2c4f89c899e17a89cecd32e Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
It makes using `capsule.sh` from scripts easier by not requiring them to find out name of the created file on their own. Change-Id: I35d26cab253f3c2b340b034b59c0c7d235dbc466 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Size of a flash chip may be greater than the firmware image size. Change-Id: Ie37a7656d81c76f66c477033a2c423f2e141dc73 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Make sure `addr` is returned on success. Previously, the code could return an positive error value. Change-Id: Ieb799ae737c0c0c07177c7315492bc6beb1b7f89 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
The handling of an incomplete last sector differed from the rest in not checking the erasure was successful. By the way, erasing the remainder of the chip at the very end also lacks verification, but maybe that was intentional. Change-Id: Id18cf668adcccaaf2f0053e7dd5aec8aa63374d6 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
The command expects the length as the second byte and by default performs a bus write. So not writing anything to the corresponding port may result in an old value being treated as the number of bytes to write. Change-Id: Ie6cf89f2aaaf1035f8ca722791c189c8c2cd5f44 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Add newline to two and specify hexadecimal base for a number in the third one. Change-Id: I1f7ca492b6b27641bc5970ab78b7ebadbe2c740d Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
An EC capsule, which is smaller than 1 MiB in size, has been observed to be coalesced into memory allocated for SMM on QEMU. If that's not a defect of resource allocation for that particular board, construction of memory map is in need of improvement. Initial attempt was to add IORESOURCE_RESERVE to the mask passed to memranges_init() to not include such regions, but it didn't help because search_global_resources() invoked during the initialization doesn't take overlapping regions into account. So the second attempt was to write a version which performs two passes: add ranges on the first one and exclude reserved and subtractive on the second one. Change-Id: I8f78779e0668261af790ca744a53a9546395acd2 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: I6f91860dbd22b7041e0273b5c9b36a317f5b0069 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
0905913 to
8c97e27
Compare
|
Approved the logic, but will test on HW today as well. EDIT: @SergiiDmytruk nv4x laptop didn't boot after flashing FW with such diff enabling the feature: λ git df
diff --git a/configs/config.novacustom_nv4x_adl b/configs/config.novacustom_nv4x_adl
index 7296e90c9871..7298dc0ce7f4 100644
--- a/configs/config.novacustom_nv4x_adl
+++ b/configs/config.novacustom_nv4x_adl
@@ -16,7 +16,6 @@ CONFIG_EDK2_BOOTSPLASH_FILE="3rdparty/dasharo-blobs/novacustom/bootsplash.bmp"
CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y
CONFIG_ALWAYS_ALLOW_ABOVE_4G_ALLOCATION=y
CONFIG_ENABLE_EARLY_DMA_PROTECTION=y
-CONFIG_EC_DASHARO_EC_UPDATE=y
CONFIG_HAVE_ME_BIN=y
CONFIG_NO_GFX_INIT=y
CONFIG_PCIEXP_HOTPLUG_PREFETCH_MEM_BELOW_4G=y
@@ -26,6 +25,9 @@ CONFIG_DRIVERS_EFI_FW_INFO=y
CONFIG_DRIVERS_EFI_MAIN_FW_GUID="b79b7279-79a4-47cf-ab2f-8636c541f2d0"
CONFIG_DRIVERS_EFI_MAIN_FW_VERSION=0x01080006
CONFIG_DRIVERS_EFI_MAIN_FW_LSV=0x01080006
+CONFIG_DRIVERS_EFI_EC_FW_GUID="79e7f788-d24c-4cb2-b1b8-ed9cd5e0c2e0"
+CONFIG_DRIVERS_EFI_EC_FW_LSV=0x00000000
+CONFIG_DRIVERS_EFI_EC_FW_SIZE=0x20000
CONFIG_DRIVERS_EFI_UPDATE_CAPSULES=y
CONFIG_DRIVERS_GENERIC_CBFS_SERIAL=y
CONFIG_DRIVERS_GENERIC_CBFS_UUID=yFans are spinning and e.g. keyboard backlight works, but the screen stays black. The firmware was built with ec.rom built from the latest Dasharo/ec commit, so it would trigger an EC sync normally. I'm guessing that something broke in the logic around it. Unfortunately, the laptop unit I picked doesn't have any debug output soldered in, so I can't recover the logs from it |
|
@filipleple, so you didn't use an EC capsule and the laptop failed to boot right after flashing?
Sounds like it didn't get to EDK, but the only new code which gets run in this configuration is in
This contradicts the removal of coreboot/src/ec/dasharo/ec/dasharo_ec.c Lines 872 to 873 in 8c97e27 Maybe check config embedded in the ROM file to see if configuration matches the expectation. |
|
@SergiiDmytruk correct, I didn't use a capsule yet, only a full flash of the rom built with a config aiming at enabling the changes. I tried to cold boot a couple times, EC reset by holding down the power button, no luck. I'll try to read the ROM back and examine the config now. |
|
Explored 3 possible reasons for the hang assuming the configuration is as expected:
|
EC's version is derived from the timestamp, so
2025-04-25_c546244becomes0x7E90419with commit hash being completely ignored and two releases on the same date looking identical (should not be a big deal). Could use BCD so the version looks like0x20250425instead which is more readable for humans.EC driver update could report success on failure to update, fixed that.
Hit a case when EC capsule was put by coreboot into an SMM area and improved how coalesced buffer is selected.
Not sure why it didn't come up earlier, but SPI bus commands sent to EC could be problematic because they omit the length byte. Maybe EC zeroes it at some point, but the code was updated to actually pass zero length.
Made
capsule.shmore suitable for use in scripts, which isn't used here immediately. See individual commits and their messages.EDK PR: Dasharo/edk2#310
issue: Dasharo/dasharo-issues#1758
ref: ncm-2275