From patchwork Thu Nov 25 07:01:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 519357 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp356836imj; Wed, 24 Nov 2021 23:03:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjKSjPQ+e1LU8cKJbXwkOP7y44bpKQPNrDKbrobmbx9Vsyzx7eReu4c5oVuRBRAePV3aIu X-Received: by 2002:a17:906:788:: with SMTP id l8mr27820563ejc.548.1637823796316; Wed, 24 Nov 2021 23:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637823796; cv=none; d=google.com; s=arc-20160816; b=hggzGXd5PV0MRTkmsz9lBdUksP1Xq8t5H+4N6UOxvjwG/z7wjt9iIsYl1vEfljTG8U 2zTXy1v6+KhgDVXqB0UGA2v9CBO8l43Qq0uQUPml9HO9OhayRUkXfdNkW0Y6NqCPx7U8 x5gOevGAk4QEkSGWgjpp+KMng3phbTRbJfdC26SILGBinXhLjnrrZrHwefQQsGzaV3Fv /rP1RVULfRrMbmoAutrCgJoCAdFeylj/atHpSzVPLizJfXftszAHdppiv+rJ9TYv1C0i UONvY5w/x/JLbd5xx7KUEkTYr28vwD/tGPConpcykB0WqTsst63pcJgaXCkvQE4D6fAn h0jQ== 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:references:in-reply-to :message-id:date:subject:cc:to:from; bh=jkx32brlUzX6lAGWc302486BdZdKR0CFUsJu+XUEpq0=; b=gXq7JO/Rj36M7/e+WtXvxTzlw0JqAINjysm8TF/4bPaUsk923RjdJLECZayCp8RN8W v1sw7F+tDnmDZMIetK6wE7WRRVZIvzLZJOdMhY2bvfTN6eRMFauzSTq+Usfq4854vXnD zc3H+knLEw6ADMOu3pXCYCkYmCbOSmCTYgdfV5NgMxk0jQVeaPdaz9d8uL5C9aRJMJ8n BtLWxSMxL/+jssl1LP+TjDbv7+0e0CqQr4NPo5cZ00RF5IBSNfVUOmQiuzJ/n9HTSAtf YVpeCTrwrU8h9BJ9jWby2HreXUcGYXTZFV7QC9n/DpIvKyS4MEFwppTMwROSozDK8vAI uksg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id nc35si7305574ejc.662.2021.11.24.23.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 23:03:16 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (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 93B5B83003; Thu, 25 Nov 2021 08:03:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4F16D82F91; Thu, 25 Nov 2021 08:03:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 41E6682DB4 for ; Thu, 25 Nov 2021 08:02:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59BFC1042; Wed, 24 Nov 2021 23:02:58 -0800 (PST) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9313C3F5A1; Wed, 24 Nov 2021 23:02:54 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , AKASHI Takahiro , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu , Sughosh Ganu Subject: [RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Date: Thu, 25 Nov 2021 12:31:37 +0530 Message-Id: <20211125070146.2389-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211125070146.2389-1-sughosh.ganu@linaro.org> References: <20211125070146.2389-1-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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 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 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 + * @param gpt_e - pointer to GPT partition table entries + * + * @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 *