Skip to content

Commit eab4675

Browse files
committed
disk: expose partition type flags
GPT partition tables include two bytes worth of vendor defined attributes, per partition. ChromeOS and Qualcomm both use these (with different encoding!) to handle A/B slot switching with a retry counter. Expose these via the disk_partition struct so that they can be parsed by the relevant board code. This will be used on Qualcomm boards to determine which slot we're booting on so that we can flash capsule updates to the correct one. Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Caleb Connolly <[email protected]>
1 parent ef14c34 commit eab4675

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

disk/part_efi.c

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,
292292
print_efiname(&gpt_pte[part - 1]));
293293
strcpy((char *)info->type, "U-Boot");
294294
info->bootable = get_bootable(&gpt_pte[part - 1]);
295+
info->type_flags = gpt_pte[part - 1].attributes.fields.type_guid_specific;
295296
if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
296297
uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b,
297298
(char *)disk_partition_uuid(info),

include/part.h

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct disk_partition {
7474
* PART_EFI_SYSTEM_PARTITION the partition is an EFI system partition
7575
*/
7676
int bootable;
77+
u16 type_flags; /* top 16 bits of GPT partition attributes */
7778
#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
7879
char uuid[UUID_STR_LEN + 1]; /* filesystem UUID as string, if exists */
7980
#endif

0 commit comments

Comments
 (0)