From patchwork Thu Nov 25 07:12:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 519368 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp367763imj; Wed, 24 Nov 2021 23:13:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRN1ipfxi5cjHTIFxzd//HmKwkeqDDc7FJaYoBOA/KVRVMH+4XLRY3emn4HjTmG2gGzH86 X-Received: by 2002:a05:6402:27cd:: with SMTP id c13mr36120713ede.57.1637824425937; Wed, 24 Nov 2021 23:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637824425; cv=none; d=google.com; s=arc-20160816; b=gCp6g8IXAWdB7cofWlJrgFFwyAAS27+KRCBjBBCmtsakBiezqza0wEvvNosbWdgafd e5wMxeku34fMpDNbGaedFsCXJLOh1ON/od7bpcEeDa5RY0ERhvlRJA8+aAB11vHYdHNH jh0LEzmwhb7IXNQpJkHTw8gRqr5NgF9g9VThNfaITkpLj779AZEah/XXfe0bDYYatLUK N4vDmQSFilmHpq3/DXE+H+EpzTOGSYNmvPHeoxR8hQ5fKSAr3y3d1SiDJThWRwrZqi5L WE0Bq305xRSX25aNxigoO1Qc1NG9Bpxc2NzsOXXYusVATcAo5zyhNQaU9de/WApFmYOs QE+g== 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=lySqkjbGY2PJvwXS7F94CQAmfptJFv9MV8hwczTDgnFY2LZh1VOXYmRp+oPo8tGPxQ /rXTw9lMTw4KUayk//Fg5tgCJXRKqmBXP8H2pT91P3jaWfNVdFbyUzPN13TnM/xPnm0C JidbAQo41xQ6TmztSipBsATN2PkHfnODHbl3BYnwHN+by37tCy/FW6hV9zD0c7xK8WvP 5UzrbOyhoPtlHcs1vjC9vuSxrpez0YbVzhYNdk0Ff7QB0Dhhf3mFTj+08tgcJj3+Kbnd CRBOWoTixU9UfFQuHEaCIr+PyLlLR2lM7r9g8dQGvH7KOOCQ6VCrnuDqB6Yv2IZ5XUhK zQLw== 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 a2si5028746edk.328.2021.11.24.23.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 23:13:45 -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 2C44283709; Thu, 25 Nov 2021 08:13:43 +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 1E4638321B; Thu, 25 Nov 2021 08:13:36 +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 894B18128B for ; Thu, 25 Nov 2021 08:13:32 +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 F1D261042; Wed, 24 Nov 2021 23:13:31 -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 364F43F5A1; Wed, 24 Nov 2021 23:13:27 -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: [RESEND RFC PATCH 01/10] GPT: Add function to get gpt header and partition entries Date: Thu, 25 Nov 2021 12:42:53 +0530 Message-Id: <20211125071302.3644-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211125071302.3644-1-sughosh.ganu@linaro.org> References: <20211125071302.3644-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 --- 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 *