[qcom-next] efi_loader: capsule: report spec-compliant ImageIndex for dynamic fw_images[] - #131
Conversation
This reverts commit c699c6d. With OSIndications now set from Kernel, OsIndications is taken into account during capsule update in U-Boot.
| Such platforms set num_images and dfu_alt_num_valid = true. When | ||
| dfu_alt_num_valid is false (the default) behaviour is unchanged: the capsule's | ||
| UpdateImageIndex is used as-is and dfu_alt_num is ignored. | ||
|
|
There was a problem hiding this comment.
Not sure if validated and tested code should be changed to handle snapdragon not aligning with the expectation. If GUID overrides the index for flashing, why cant Qualcomm use an index that is inline with EFI expectation?
There was a problem hiding this comment.
Not sure if validated and tested code should be changed to handle snapdragon not aligning with the expectation. If GUID overrides the index for flashing, why cant Qualcomm use an index that is inline with EFI expectation?
Hi, index varies across boards, depending the on the partitions present on a given board.
Hence, we cant use index for identifying dfu string (and so we relyon GUID).
Also, testing for capsule update is yet to start, hence, doing the change now, so testing can validate these changes also.
b484d4a to
347d6a9
Compare
|
|
||
| struct efi_capsule_update_info { | ||
| const char *dfu_string; | ||
| int num_images; |
| /** | ||
| * efi_capsule_resolve_image_index - map a capsule to its platform image index | ||
| * @image_type: Image type GUID from the capsule (UpdateImageTypeId) | ||
| * @capsule_index: Image index from the capsule (UpdateImageIndex) | ||
| * | ||
| * Return the image_index to use for efi_fmp_find() and set_image(). The weak | ||
| * default trusts the capsule's own UpdateImageIndex, so behaviour is unchanged | ||
| * for platforms with a static 1:1 fw_images[]. A platform whose fw_images[] is | ||
| * built dynamically (so the capsule's UpdateImageIndex cannot be relied on) | ||
| * overrides this to resolve @image_type to its own image_index. | ||
| * | ||
| * Return: the image_index to use for efi_fmp_find() and set_image() | ||
| */ |
There was a problem hiding this comment.
The info in the include/efi_loader.h for the prototype is better. This can be dropped.
| /** | ||
| * efi_capsule_resolve_image_index - map a capsule to its platform image index | ||
| * @image_type: Image type GUID from the capsule (UpdateImageTypeId) | ||
| * @capsule_index: Image index from the capsule (UpdateImageIndex) | ||
| * | ||
| * Return the image_index to use for efi_fmp_find() and set_image(). The weak | ||
| * default trusts the capsule's own UpdateImageIndex, so behaviour is unchanged | ||
| * for platforms with a static 1:1 fw_images[]. A platform whose fw_images[] is | ||
| * built dynamically (so the capsule's UpdateImageIndex cannot be relied on) | ||
| * overrides this to resolve @image_type to its own image_index. | ||
| * | ||
| * Return: the image_index to use for efi_fmp_find() and set_image() | ||
| */ |
There was a problem hiding this comment.
Drop. Comments in the header is enough and it is better
|
|
||
| struct efi_capsule_update_info { | ||
| const char *dfu_string; | ||
| int num_images; |
Platforms that build their fw_images[] array dynamically from the partition table (e.g. Qualcomm Snapdragon) assign each descriptor a fixed, per-component image_index. Because a given board only carries a subset of components, those values can fall outside the range 1 <= ImageIndex <= DescriptorCount that UEFI 2.9A section 23.1 requires GetImageInfo to report. Such a platform must instead assign image_index sequentially (1..num_images), after which the capsule's UpdateImageIndex can no longer be trusted to select the right image. Add a __weak efi_capsule_resolve_image_index() that maps a capsule to the image_index used for efi_fmp_find() and set_image(). The default returns the capsule's UpdateImageIndex unchanged, so platforms with a static 1:1 fw_images[] are byte-for-byte unchanged. A platform with a dynamically built fw_images[] overrides it to resolve the payload by image_type_id (GUID) to its own sequential image_index; the generic code carries no platform-specific policy. Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Build on the generic weak hook and make Snapdragon's dynamically built fw_images[] spec-compliant: image_index is assigned sequentially (i + 1) in qcom_build_fw_images(), so GetImageInfo reports ImageIndex values in 1..DescriptorCount as required by UEFI 2.9A section 23.1. Once image_index is sequential it depends on which components a board carries, so it can no longer match the capsule's frozen UpdateImageIndex. Override efi_capsule_resolve_image_index() to map an incoming payload to its image_index by image_type_id (GUID); the generic capsule flow uses that resolved index for both efi_fmp_find() and set_image(). No flag on the shared struct is needed - platforms that don't override keep the weak default and are unaffected. Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Add the multiimgqti component (partition multiimgqti_a/_b, image type GUID 846c6f05-eb46-4c0a-a1a3-3648ef3f9d0e) to qcom_image_map[] so boards that carry it can capsule-update it. It is appended with a new authoring index (17) so the frozen indices of already-authored capsules are preserved. Drop the apdp component from the map. Removing a row leaves a gap in the authoring-index sequence (15); this is harmless because the index is only compared by value (rule-1 dedup) and is never used as an array subscript, and the runtime fw_images[].image_index is assigned sequentially regardless. Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
347d6a9 to
bc25e9b
Compare
Platforms that build their
fw_images[]array at runtime from the partitiontable (Qualcomm Snapdragon) assign each descriptor a fixed, per-component
image_index. A board only carries a subset of components, so those indicescan fall outside
1 <= ImageIndex <= DescriptorCount— the range UEFI 2.9A§23.1 requires
GetImageInfoto report.This series makes such platforms assign
image_indexsequentially and resolvescapsule payloads by image type GUID instead of by index, so the reported
descriptor array and the ESRT stay in range. Platforms with a static 1:1
fw_images[]are unaffected.