EC capsules#922
Conversation
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Id1b33912eb0172b430dbf3bf3073a823aee8d4d2 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This replaces CONFIG_EDK2_CAPSULE_ON_DISK_SUPPORT and CONFIG_EDK2_SHOW_CAPSULE_REPORT to avoid proliferation of trivial options which are always enabled together. Most wouldn't show up anywhere but build-system files. Similarly switch from specifying individual PCDs for EDK to passing a macro which will do the same but on the side of EDK. There is no need to bake this knowledge into coreboot's build system. Change-Id: I603c08d07c325e4d05b86edb6667694a21212c1d Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: Iaccb60dedad5ea089f297968e7c0778b052d87de Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: I2b89e14e9e4d554945eb6bccdb03778e03a16f7e Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Integrate the functionality of capsule_cabinet.sh into capsule.sh. Cabinets can now be created using `./capsule.sh create_cabinet capsule.cap`. Prior functionality and calls of capsule.sh remain unaffected. Change-Id: I5c9a2aec62722a665aaef10634d729461dca64c9 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Add a command that allows uploading built cabinets to LVFS. Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
…RESS The PCD flag has been obsoleted by recent changes that provide a fallback mechanism in the graphical path in case the GOP is not available (monitor is not plugged in) Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Iddfa6b6c4836ef3606e079a896b7b2e8da4ee715 Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Change-Id: I6af426d7fcb6eb4e403c995633127050bbef5028 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upon detecting that sealed capsules are enabled:
1. Force the use of test keys for signing a capsule with coreboot.rom
and drivers.
2. Wrap that capsule into another capsule signed with the user-supplied
keys.
3. Remove that first capsule.
Upstream-Status: Inappropriate [Dasharo downstream]
Change-Id: I80f7870439d92a657df23a2740579e1bb246b18e
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
* include sizes in two log lines of is_good_capsule_head() * spew addresses of SG blocks as they are processed Change-Id: I002747dcc8330076745dca8dafde04105c707312 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
* This option prevents capsule.sh from generating capsules of a new kind to permit updates from a previous release. * Set the option for MSI boards. Change-Id: Ia87cb23c62f8b2296a332b3416367cb4ad931cee Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Iedbcfcbca5c048774ae66cd4cf4566500cd615e8 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
If CapsuleRootKey.inc exists and CONFIG_EDK2_CAPSULES_V2 is set, copy the file to EDK. This needs to be done as part of coreboot's build process because EDK's worktree doesn't exist right after cloning coreboot and there is no way to initialize it without building coreboot. This makes it impossible to provision EDK's key before the build without coreboot knowing about it at some level. Also reset DasharoPayloadPkg/CapsuleRootKey.inf in EDK if CONFIG_EDK2_CAPSULES_V2 is enabled, like it's already done for logos. Not adding the file to .gitignore so it's more visible to the user when present. Change-Id: I8b557c4ab239d61a5cef01928fda13b8417d54cb Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: Ia9462cc4997dd04a17bc43d41fd3f8a08d318341 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
There was one outlier in this file. Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: I3334d8eccaf64c57fc37580dce3d057938795427 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
…ates Check that `CONFIG_EDK2_CAPSULES_V2=y` is not added to `CONFIG_DRIVERS_EFI_UPDATE_CAPSULES=y` without `CONFIG_EDK2_CAPSULES_V2_TRANSITION=y`. Check that `CONFIG_EDK2_CAPSULES_V2_TRANSITION=y` doesn't live longer than one release cycle. Check that `CONFIG_EDK2_CAPSULES_V2_TRANSITION=y` is not added to `CONFIG_EDK2_CAPSULES_V2=y`. Check that `CONFIG_EDK2_CAPSULES_V2_TRANSITION=y` is not removed. Change-Id: I24a1fd41864983fff3f9dfa717a0e4a7505fecac Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
They will reused by upcoming changes. Change-Id: Ie81e82f402e4c171f957a9b53b1e40dc559d19a4 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Takes a capsule and signing keys, unpacks the capsule, then packs it back under a (likely) different name. Two functions were borrowed from a script in OSFV. Change-Id: I23157aaeedb4e1fdcfb10c5a0235acd571aa72b4 Upstream-Status: Inappropriate [Dasharo downstream] Co-authored-by: Filip Gołaś <filip.golas@3mdeb.com> Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This allows bundling capsule.sh with gencap/ created by `capsule.sh box` and use it standalone for resigning. Change-Id: Ia36460ce4ab510b1719a2560594529304a0fe3f0 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: I36bb570f2cf02c8f421298ef95e787cd91548d01 Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This option signifies missing implementation of tsc_freq_mhz() which results in tsc_freq_mhz() from src/arch/x86/timestamp.c returning zero. That zero in turn gets put into TIMESTAMP CBMEM table requiring payloads and user-space tools to figure out the frequency on their own. Implement tsc_freq_mhz() to query timer frequency in coreboot, so it gets reported downstream. Change-Id: I88d1206c13f15a9f20c07b65dcec42ec614f7e6a Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
cbfstool invocations were concatenated one after another with no separators resulting in an invocation error. Add an empty line at the end of each invocation. Change-Id: Ie6be3eb2264756500296f614896e170afc1c9cf0 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Enabling all supported components other than the compiler one as its upstream version doesn't describe coreboot-specific patches. Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Ie2371bf3c79df1b2a3de6518c37d647bc5d1ca64 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Icc2a74e208d5290090db528dd81ce0f711066061 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
The target didn't depend on the output directory, so the corresponding recipe failed. Upstream-Status: Pending Change-Id: Ia409af3ff5d9763dec181d131f5fb5629b49f931 Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
UEFI DBX keeps growing in size and we have enough UEFI variables to start running out of space with 64 KiB of storage (with 4 blocks available only one of them is used for data, then there is working area and fault-tolerant area). Double the SMMSTORE region in size to 512 KiB which triples amount of space available for variables (so 192 KiB with DBX consuming 23.44 KiB). Change-Id: Id3bcbcc2532b9a0f6865e2d109cb6c57435f89ea Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Change-Id: Ic0b5123eae7081f823b9e0f674238bef9946b54f Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Move the mountpoint to /tmp, where permissions should not be a an issue. Upstream-Status: Inappropriate [Dasharo CI] Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
If a new defconfig was added between the previous and current tag, the
script failed with an error like this:
fatal: path 'configs/config.gigabyte_mz33-ar1' exists on disk, but
not in 'msi_ms7e06_v0.9.4'
Change-Id: Ic50dbfb5432cc59ec2ac9e14eb5296e08fe28da2
Upstream-Status: Inappropriate [Dasharo downstream]
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Upstream-Status: Inappropriate [Dasharo downstream] Change-Id: Idac92c5a642a3b1d34285aea3315254c27ddf924 Signed-off-by: Michał Kopeć <michal.kopec@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:
|
|
I've retrieved the config, it looks as expected, that is the current nv4x config with the EC capsule feature enabled. |
Yes, the config is exactly as it should be. I've noticed two more things in the code:
|
Doesn't seem like there are issues with that code. Threw operations on random ranges at it and couldn't produce a hang. Inspecting the code didn't reveal bugs either. |
f54c4b9 to
3429045
Compare
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