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 4F5B9C433F5 for ; Thu, 9 Dec 2021 01:33:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C25183493; Thu, 9 Dec 2021 02:33:22 +0100 (CET) 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="TUUGvBMa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F30198347C; Thu, 9 Dec 2021 02:33:17 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 EA780833C3 for ; Thu, 9 Dec 2021 02:32:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102d.google.com with SMTP id y14-20020a17090a2b4e00b001a5824f4918so5696990pjc.4 for ; Wed, 08 Dec 2021 17:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=OHCpaRpU7NeL/aJqhKlf96DEgPgdBje7GZixmI/is0I=; b=TUUGvBMaVg43eESqO+j9FLVvJH7toHSoW0sP5kROUEIDNVuaio3ClBVQLX4b8nhb/C NahxoWsSB7QQn8ZBfAwVZ3g86Vcyf6DcB3xrSxEAVtfCklVvEsrNRiWzq/93Be1gHm7o 9kF2qAp7pcBKrXl/5mcR1hsLvoZTkN7ytAyqCqmXG3Lf3aKaXuKhue/2xZtTUaEfPde6 prDkSWGLrw9qhHKIsa4VKJPh3iZff6JD+7BCVG/vthtw/5/tcIHMGsrWgLna+ar5wWRO O6kvUV8EDClAbVR4L2kWSrMGaOuhhgSCq4wpwSRa9x7Uk3+GYu9VH70J9/ugnajX0K6v pqOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=OHCpaRpU7NeL/aJqhKlf96DEgPgdBje7GZixmI/is0I=; b=NfViiA2jhTEThKQPs4l4Ze8jc9ESPcOcOgkE3LFtA5MkIW2RpogJypc+sNwCwDmD5c yONvRLgDiE/7xNlQaTR1OEao5bnREFv2bPN3T6lXFYt5X/l9fuIdNc9U10UtcUnERRev yHoBpv7O3HF6IrmyoNDlWWPCUtMpjoJsag77y+45aVYzVyNo5TULLVtnegd/Omuwr05F 6IfSZioVUUAdJYmibdi8QxeMCbJ55FzctUdzs1OXoXdn80qLLD0JEcRPp0/Bb1hZjNbD G7t+CnpLZ8CE1qdwoilOUHKzG1g1X1OvTiyva6IyRYSITnk/6P1CDOVc8TB0x51V2AO5 O4Jg== X-Gm-Message-State: AOAM531yVY/lXdCgz91Fozhp0KNZUXOa2MI1bWG428KRZyZ9bIfeA39/ TB9raU56Cd+lw7RUqWHNof9TFg== X-Google-Smtp-Source: ABdhPJyevj9SCr8L5SF4irGOtXP3ALbiXmc2a4ZxdODHK0U4xoJ+i11FgBfe+wf61RZKRAE9TlnadQ== X-Received: by 2002:a17:90b:4a05:: with SMTP id kk5mr11615899pjb.142.1639013566081; Wed, 08 Dec 2021 17:32:46 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:9c7e:5a6d:3f01:d562]) by smtp.gmail.com with ESMTPSA id g1sm3597125pgm.23.2021.12.08.17.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 17:32:45 -0800 (PST) Date: Thu, 9 Dec 2021 10:32:40 +0900 From: AKASHI Takahiro To: Sughosh Ganu Cc: Patrick DELAUNAY , u-boot@lists.denx.de, Patrice CHOTARD - foss , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu Subject: Re: [RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Message-ID: <20211209013240.GD40837@laputa> Mail-Followup-To: AKASHI Takahiro , Sughosh Ganu , Patrick DELAUNAY , u-boot@lists.denx.de, Patrice CHOTARD - foss , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu References: <20211125070146.2389-1-sughosh.ganu@linaro.org> <20211125070146.2389-2-sughosh.ganu@linaro.org> <013a01d7eb80$0b295b80$217c1280$@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Wed, Dec 08, 2021 at 01:10:51PM +0530, Sughosh Ganu wrote: > hi Patrick, > > On Tue, 7 Dec 2021 at 21:05, Patrick DELAUNAY > wrote: > > > 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 > > > > > Will add this comment to the description. > > > > > > > > + * @param gpt_e - pointer to GPT partition table entries > > > > > > > > gpt_e is allocated in this fucntion need to freed by caller > > > > > Will add this comment to the description. > > > > > > > + * > > > > + * @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" > > > > > find_valid_gpt is not being exported. It is defined statically in > part_efi.c. Do i misunderstand your comment? > > > > > > > > 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 > > > > } > > > > > I had actually explored using part_get_info. But the type_guid field is > actually a char string. While I need the guid value to compare it using > guidcmp. Which is the reason I introduced get_gpt_hdr_parts. Think of using uuid_str_to_bin() if this is the only reason. -Takahiro Akashi > -sughosh > > > > > > Regards > > > > > > > > Patrick > > > >