]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
disk: expose partition type flags
authorCaleb Connolly <caleb.connolly@linaro.org>
Sat, 12 Oct 2024 13:57:18 +0000 (15:57 +0200)
committerCaleb Connolly <caleb.connolly@linaro.org>
Wed, 20 Nov 2024 16:57:58 +0000 (17:57 +0100)
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 <ilias.apalodimas@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
disk/part_efi.c
include/part.h

index bdcfcba5d51bd7b76a58c795ec6b76ff1f292c76..932d058c184ce6946b7142e7c2d9637b28e4661e 100644 (file)
@@ -292,6 +292,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,
                 print_efiname(&gpt_pte[part - 1]));
        strcpy((char *)info->type, "U-Boot");
        info->bootable = get_bootable(&gpt_pte[part - 1]);
+       info->type_flags = gpt_pte[part - 1].attributes.fields.type_guid_specific;
        if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
                uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b,
                                (char *)disk_partition_uuid(info),
index 92662677551173915c7c196a99557e7e1cda32db..fcb3c13dea4de6346ad98d6ce320ef36747dda85 100644 (file)
@@ -74,6 +74,7 @@ struct disk_partition {
         * PART_EFI_SYSTEM_PARTITION    the partition is an EFI system partition
         */
        int     bootable;
+       u16     type_flags;     /* top 16 bits of GPT partition attributes      */
 #if CONFIG_IS_ENABLED(PARTITION_UUIDS)
        char    uuid[UUID_STR_LEN + 1]; /* filesystem UUID as string, if exists */
 #endif