From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFCAEC433F5 for ; Tue, 7 Dec 2021 15:35:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8665D80F90; Tue, 7 Dec 2021 16:35:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="LEFI7LPI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 580B181423; Tue, 7 Dec 2021 16:35:36 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C68C680F81 for ; Tue, 7 Dec 2021 16:35:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=6975ae474c=patrick.delaunay@foss.st.com Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1B7Eivfv018748; Tue, 7 Dec 2021 16:35:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : references : in-reply-to : subject : date : message-id : mime-version : content-type; s=selector1; bh=joHYsd3zWxkYtbL0xWO2U5+XZ2CgRN89Yr7X/W5appA=; b=LEFI7LPIiKIyT9oLMKfqwrW2uI1QVYNICDAogdl/WuA4iAaCvBIMKahqVrfcaxN4SCFQ pHf8lKQD1krIT3UG4Gc2cNuhwfhQciU9BqJ5yXgAQk+C6F4huOnVaQSf5CxxMTmLu1Sx 4UIVwO/RFV3FVShU60RuB0RMTcuHuDX6/gXnqkJP7VvnHPVYDj4CtD5KdV9o2qW35FLc +1Lu8cgKEN71AyEZO40xFrexYQO/PtGvyM7DS+Je6PjvxoGwaXSn6/hJIhWx2H7EU7zP a2xqBnHPxUiyejI1hPkgX+/w47Kig94CWjHFS8AUL1BoF4mZf7Z14r79Zwzrp0RdHhWl 3Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3ct4rasyud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Dec 2021 16:35:22 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BCDFC10002A; Tue, 7 Dec 2021 16:35:21 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id AD7702052CB; Tue, 7 Dec 2021 16:35:21 +0100 (CET) Received: from LMECWL0930 (10.75.127.46) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Tue, 7 Dec 2021 16:35:17 +0100 From: Patrick DELAUNAY To: 'Sughosh Ganu' , CC: Patrice CHOTARD - foss , 'Heinrich Schuchardt' , 'Alexander Graf' , 'Simon Glass' , 'Bin Meng' , 'Peng Fan' , 'AKASHI Takahiro' , 'Ilias Apalodimas' , 'Jose Marinho' , 'Grant Likely' , 'Jason Liu' References: <20211125070146.2389-1-sughosh.ganu@linaro.org> <20211125070146.2389-2-sughosh.ganu@linaro.org> In-Reply-To: <20211125070146.2389-2-sughosh.ganu@linaro.org> Subject: Re: [RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Date: Tue, 7 Dec 2021 16:35:14 +0100 Message-ID: <013a01d7eb80$0b295b80$217c1280$@foss.st.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: fr Thread-Index: AQIH+0gQFK5I6fuegxpcZhuULZ0W3AGrQnlVAPDeShg= msip_labels: MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_Enabled=true; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_SetDate=2021-12-07T15:35:11Z; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_Method=Standard; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_Name=23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_SiteId=75e027c9-20d5-47d5-b82f-77d7cd041e8f; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_ActionId=4c1039ab-6e11-4d18-801e-5bd0c17f9696; MSIP_Label_23add6c0-cfdb-4bb9-b90f-bf23b83aa6c0_ContentBits=2 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-07_06,2021-12-06_02,2021-12-02_01 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.38 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean Hi Sugosh On 11/25/21 8:01 AM, Sughosh Ganu wrote: Add function to get the gpt header and partition entries filled. These would be used subsequently for multi bank firmware update support on devices where the images reside on GPT partitions. Signed-off-by: Sughosh Ganu --- disk/part_efi.c | 10 ++++++++++ include/part.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/disk/part_efi.c b/disk/part_efi.c index 0ca7effc32..792b9218a9 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -216,6 +216,16 @@ int get_disk_guid(struct blk_desc * dev_desc, char *guid) return 0; } +int get_gpt_hdr_parts(struct blk_desc *desc, gpt_header *gpt_head, + gpt_entry **gpt_pte) +{ + /* This function validates and fills in the GPT header and PTE's */ + if (find_valid_gpt(desc, gpt_head, gpt_pte) != 1) + return -EINVAL; + + return 0; +} + void part_print_efi(struct blk_desc *dev_desc) { ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz); diff --git a/include/part.h b/include/part.h index b66b07a1f0..8e86485b97 100644 --- a/include/part.h +++ b/include/part.h @@ -345,6 +345,20 @@ struct part_driver { #if CONFIG_IS_ENABLED(EFI_PARTITION) /* disk/part_efi.c */ + +/** + * get_gpt_hdr_parts() - Get information on the GPT Header and + * Partition Table Entries + * + * @param desc - block device descriptor + * @param gpt_h - pointer to GPT header representation gpt_h need to be allocated / DMA alligned by caller + * @param gpt_e - pointer to GPT partition table entries gpt_e is allocated in this fucntion need to freed by caller + * + * @return - zero on success, otherwise error + */ +int get_gpt_hdr_parts(struct blk_desc *desc, gpt_header *gpt_head, + gpt_entry **gpt_pte); + /** * write_gpt_table() - Write the GUID Partition Table to disk * no need to export the low level function "find_valid_gpt" the same services are already provided by part_get_info() ? ST Restricted 2 information are used in the serie => gpt_head->num_partition_entries => &gpt_pte[i].partition_type_guid type_guid is available in disk_partition, and num_partition_entries is not needed (replaced by MAX_SEARCH_PARTITIONS) something like: struct disk_partition info; for (p = 1; p < MAX_SEARCH_PARTITIONS; p++) { if (part_get_info(desc, p, &info)) continue; => info.type_guid } Regards Patrick