From patchwork Mon Jun 3 12:49:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 801246 Delivered-To: patch@linaro.org Received: by 2002:a5d:65c4:0:b0:35b:5a80:51b4 with SMTP id e4csp1897554wrw; Mon, 3 Jun 2024 05:49:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUyrZQVHenPCbD5pFzwRgNyrOUdOhmYNUJSRxox5GC/N4avm+yt+wIf5gosbMMAYHq/mAzNx4FPm0VZ4kmKmU+9 X-Google-Smtp-Source: AGHT+IFq56WMX+mE+CcyKnM+652fkglbYEryh9MGqpUWhYhsDWTaPrriJTlJhVxRkZ5q/luEjhh1 X-Received: by 2002:a17:906:1b5b:b0:a68:c672:9ea9 with SMTP id a640c23a62f3a-a68c672a238mr358607266b.28.1717418975242; Mon, 03 Jun 2024 05:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717418975; cv=none; d=google.com; s=arc-20160816; b=mbxVQ543JJi8UUhT3uAxl84/budjxnJJU+GMcFVdoPc1cjuK8CiN9J8mWJ7000VN1A jiavd/ljkloFMhlRRdhQ3Ab6WSr2MRCkUGDC450hheyB4gRz9NfvfYdxHPhnODKJyy7X ph8I44SospFIhnhajubBmWuMAaqaKft0b5Bjj3mD1iDrPZEHr7iP5N3mLJFJPhMDHNBC hk2MC+beit800ctAtZweEF0GbzY6DUOg9rZfCYZDbMhrY4fk0V+QU294/M4ia4JI0qnZ obOufu5qXRGcPoqRIxBaIvHAeBamZGmKdMwZJRpW1L/5m+Jew+9m7z4W0/Ydp0V7BOe+ 9wvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=TsLrwe77MphWY0YcELWYdgLVdM7F1B/rZUAF0i5P55I=; fh=VCc3BUTJ2y6IUymk5X4lcQatZaxz97N2bsHppRiXonI=; b=FtHlrZ35Bd8pt2OJnUqnq2emB25pCJ4Yp23NMMasTOyHB4xwtOT0J0GJxRuAe/2uB1 QEfP7/aEnJTXB+a8ZeNjkWRal7jlODKq+MGZM1y9hbmzn92lt/fkPHR42NJ/nYJHEhEK IjCJhKYD7B2YYfU9dz8disevP24EzFRtYy3tgnb6KDfTWhEbSHXTiZWJFY3wy0Ra6Qbr dhk7k5G4WW8ClPL/6aJcUIfe+wgJ2Xe56wLdYsPY+HC6+NcvYha2Sf9HkBppu0Q50RK7 lH56CEcDFC86eMq9XpEWHSs0gwBFuOXLyg+4NYPMXgC6MraKzPirRbAwymBRACBJp11I b08A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mMxGUfit; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a68a251d384si296993966b.27.2024.06.03.05.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 05:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mMxGUfit; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09310882AF; Mon, 3 Jun 2024 14:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mMxGUfit"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3918088324; Mon, 3 Jun 2024 14:49:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E5BAC882AC for ; Mon, 3 Jun 2024 14:49:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a6302bdb54aso565509466b.0 for ; Mon, 03 Jun 2024 05:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717418961; x=1718023761; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TsLrwe77MphWY0YcELWYdgLVdM7F1B/rZUAF0i5P55I=; b=mMxGUfitaKrJHgT/F8E9MzOaUXgjWjV1DjrSPOvmuAyOEY682awRpf4lWQ16pvzdCi Y3vOHlxzS+dO20458wkp1lYJIqL01hacoI6G6Tv/YtKczcSgLLhPBj4naV/dy0plExq6 2sup+zQs+ZJure3Pfex6dtlXfkr1jiW068M+d6Y++uZbXOOiKBBwOcdUVuVE8XtWTlvU ceFK9cICJDWYj564OzEfk19hj+jbmMy2HwMUdEAQx5OBq+uMpqpq/4FaxIdLtY95N/Vb Hhd+FipFfv1PFDfokFKGp526MI9OHjKR/ag45v8cTe/3UTTIvtTuCWOf2XTt8E64y/7f LEOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717418961; x=1718023761; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TsLrwe77MphWY0YcELWYdgLVdM7F1B/rZUAF0i5P55I=; b=Rr0/abfA3FwtAv8LjxqfZd5DL9U2gKxoIB06HKtgkDk0rhW2dtKe0ztG8YwLv5bhoJ V5dlD0sExTGgfmNJJ+W1sxMfVCFWEdEPnhW1+Ln/cHgVbctVT5ryhunF1KIJqD1OYVpO Q6mumZPEeL9Li1GrGtaK0pHQi+FsBX3RQfK2koYGscmCExiGfUf3I4WPTevOfn/p26pA wYYVfe8I3LlbQZnyykSu2rVA539pCBt3KL5DkOLvLyfW+loHf+Lgff5YGj+Wcb2fw+P2 BMl8AeYmg44nGBDP6FS1hiGG6B08gqdGBslNBF68EIVvIlWRuKIR63hkIyGb8b815LbM 6NCw== X-Forwarded-Encrypted: i=1; AJvYcCWWOikZ0kfnlM3nFlazpCUQxRt28YAvT6V3+NRDpflyUpUGHlm9EGt5nqfvq2MMEvseRdLKzkA3enNSBdVPVXNAB0YKWw== X-Gm-Message-State: AOJu0Yx2lKYROao3y9vdl1X8HIoNKlGcurelOMf+bUcvdlhJvoadae3F IiwCrVOi8LvzmjYsJWQYTQZheR1ZTN6xQandomxjFea3IJhL7LHcNg9RRE1X6wU= X-Received: by 2002:a17:906:27ce:b0:a68:f8b9:ffa3 with SMTP id a640c23a62f3a-a68f8ba0035mr210645166b.46.1717418961361; Mon, 03 Jun 2024 05:49:21 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::8090]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a691cd07c72sm98917066b.170.2024.06.03.05.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 05:49:20 -0700 (PDT) From: Caleb Connolly Date: Mon, 03 Jun 2024 14:49:17 +0200 Subject: [PATCH v3 2/8] disk: expose partition type flags MIME-Version: 1.0 Message-Id: <20240603-b4-qcom-capsule-updates-v3-2-fe2e083289ec@linaro.org> References: <20240603-b4-qcom-capsule-updates-v3-0-fe2e083289ec@linaro.org> In-Reply-To: <20240603-b4-qcom-capsule-updates-v3-0-fe2e083289ec@linaro.org> To: Tom Rini , Simon Glass , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: Ilias Apalodimas , u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1946; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=6r6o+LARxoUfqXvO6HRYgyNJUDpuL2kNJVwCc7gQ/4M=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmXbvNAJ2Jfm3J8hw8bYT0Lk+zvfwvCoq6WP61l 80Pu7qH7cyJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZl27zQAKCRAFgzErGV9k thuZD/wNvsSqR0r0EOrVxGpHjhu+ExvMV1GvqYbcxOmUu3ipp/4ZkbDzdyoBnLUhihQJWnLHcTB tCiKR2dLWottkBsUZ9zw11xnzhSmtFk/PDpTt8els64QIlPMIroz27t8PbBwN5PJj4aeMFn55IJ XPk21sloQfR2JlExPLlsGtICzctsCMkMF5Wn+w/3eNluCfETJAJk+oK7BMl/PrG3lMlA/TT6San lDRplKOaE5wlPgLWHwicnsmE9PL/e2AoqH8JPU6Vxu7uoNSvi+RSzJaEGN3IVDgr3U5xbjkEQ/+ FZptqghTY9eQT1H8FxiTVsxPpngcLgiPYId86ksz3JSq39DM/mB3kjcNNy498Z0wWZxU+ncNwyE nQa4Y4YiA9eJWUV+Qvjrf+0Cpd2p/5dGUFoKAkzRAu95L/vZJqyd6DljZp0jMC7SNkZNVo+YQjT mVgm3iP4iScigoh+eM4AK/XN6dgfzxztvq5f6K95iwPjrP0Bu10OZfEAHngOwvK+gnyvAD1oACB PRDudCOG6RD3h23tFyK0dHZYpKHFGj7dy6RMj4fOf18EIckQ9LGo4HBCy+GQws2/0rgZf/JJMHT rQ0WLbnNOko97BXopAI9xe8HRw/lKy/0qH0+CYqZwFa2op2pYQ7qIX0wTA9sUtLwzljM8scAgqB GFB1UxshE5rQoOA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- disk/part_efi.c | 1 + include/part.h | 1 + 2 files changed, 2 insertions(+) diff --git a/disk/part_efi.c b/disk/part_efi.c index b1a03bd165e0..bde4adcfa087 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -291,8 +291,9 @@ int part_get_info_efi(struct blk_desc *desc, int part, snprintf((char *)info->name, sizeof(info->name), "%s", 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), UUID_STR_FORMAT_GUID); diff --git a/include/part.h b/include/part.h index 32ee40488563..afae51f1b933 100644 --- a/include/part.h +++ b/include/part.h @@ -68,8 +68,9 @@ struct disk_partition { * PART_BOOTABLE the MBR bootable flag is set * 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 #ifdef CONFIG_PARTITION_TYPE_GUID