All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
To: 'Sughosh Ganu' <sughosh.ganu@linaro.org>, <u-boot@lists.denx.de>
Cc: Patrice CHOTARD - foss <patrice.chotard@foss.st.com>,
	'Heinrich Schuchardt' <xypron.glpk@gmx.de>,
	'Alexander Graf' <agraf@csgraf.de>,
	'Simon Glass' <sjg@chromium.org>, 'Bin Meng' <bmeng.cn@gmail.com>,
	'Peng Fan' <peng.fan@nxp.com>,
	'AKASHI Takahiro' <takahiro.akashi@linaro.org>,
	'Ilias Apalodimas' <ilias.apalodimas@linaro.org>,
	'Jose Marinho' <jose.marinho@arm.com>,
	'Grant Likely' <grant.likely@arm.com>,
	'Jason Liu' <jason.hui.liu@nxp.com>
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	[thread overview]
Message-ID: <013a01d7eb80$0b295b80$217c1280$@foss.st.com> (raw)
In-Reply-To: <20211125070146.2389-2-sughosh.ganu@linaro.org>

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  <mailto:sughosh.ganu@linaro.org>
<sughosh.ganu@linaro.org>
---
 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

  reply	other threads:[~2021-12-07 15:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  7:01 [RFC PATCH 00/10] FWU: Add support for FWU Multi Bank Update feature Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Sughosh Ganu
2021-12-07 15:35   ` Patrick DELAUNAY [this message]
2021-12-08  7:40     ` Sughosh Ganu
2021-12-09  1:32       ` AKASHI Takahiro
2021-12-09  9:00         ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 02/10] stm32mp: dfu: Move the ram partitions to the end of the dfu_alt_info variable Sughosh Ganu
2021-12-08 13:13   ` Etienne Carriere
2021-12-09  9:04     ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 03/10] FWU: Add metadata structure and functions for accessing metadata Sughosh Ganu
2021-12-08 13:53   ` Etienne Carriere
2021-12-09  9:42     ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 04/10] FWU: Add metadata access functions for GPT partitioned block devices Sughosh Ganu
2021-12-07 14:23   ` Patrick DELAUNAY
2021-12-08  7:18     ` Sughosh Ganu
2021-12-09  2:32   ` Simon Glass
2021-12-09  9:01     ` Sughosh Ganu
2021-12-09  9:35   ` Jason Liu
2021-12-09  9:46     ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 05/10] FWU: stm32mp1: Add helper functions for accessing metadata Sughosh Ganu
2021-12-07 14:33   ` Patrick DELAUNAY
2021-12-08 10:18     ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 06/10] FWU: STM32MP1: Add support to read boot index from backup register Sughosh Ganu
2021-12-07 14:27   ` Patrick DELAUNAY
2021-12-08  7:21     ` Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 07/10] EFI: FMP: Add provision to update image's ImageTypeId in image descriptor Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 08/10] FWU: Add boot time checks as highlighted by the FWU specification Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 09/10] FWU: Add support for FWU Multi Bank Update feature Sughosh Ganu
2021-11-25  7:01 ` [RFC PATCH 10/10] FWU: cmd: Add a command to read metadata Sughosh Ganu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='013a01d7eb80$0b295b80$217c1280$@foss.st.com' \
    --to=patrick.delaunay@foss.st.com \
    --cc=agraf@csgraf.de \
    --cc=bmeng.cn@gmail.com \
    --cc=grant.likely@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jason.hui.liu@nxp.com \
    --cc=jose.marinho@arm.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.