From patchwork Thu Sep 21 22:51:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 113934 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2567136qgf; Thu, 21 Sep 2017 15:52:14 -0700 (PDT) X-Received: by 10.80.193.26 with SMTP id l26mr2662343edf.97.1506034334064; Thu, 21 Sep 2017 15:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506034334; cv=none; d=google.com; s=arc-20160816; b=YJJ8m6pdf2Pb6vlnlxwu7uFMHe45JP24lQkBRci8wege1q4RYYkWAXODY4K6l+2EGQ snmQzFSbB+pdh4i3oKmjgMXT9PfCDVlVKKAuMMeunS0bpAuio+Cf332lbNoOCbXiy3mK qc4iEpA6/1LAA1tBC4sUySEaZX02xwh1wODwk6oCFzmMBCCaitcZp3UKqOCI5kQyrLq1 TxT3NYlWACLLAoCdW481UfV6ITIegYPWoDe5jCzquRRvq62Hfpap14vIlp7xokRk0nIE MPHwGUpPqbZBG5EVGpC0ydM5ATEfPkIHlhOn+O50xgI4UY8KEoX7dPPaHLKvHZzc20RS UvvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=JvtG4G7rD/H4Yt3dNNrTztGBObA2ZesLyRbn1NfaLIo=; b=YJM56GV/ev+GG6hv+Sbk31XvS+sQ8bP6wVKXQMvcbmAVAbq+ChLQAefHHGDLRgSeux 6H5fCxLzJmm/uEw2M5XQffs9kJtyx3BQ4/pY3UUnKW7KvkEKwteVsnXGRkYU/SnK1Csy i2rxU2dkR/hs/KzkXD+TrElJwLMV31/nGZVl0bulPyfNT0miJdzbSS8pYggBlRaPFtn7 oynsT4KbtZNaKYCi8vhUCctHqVfuH+NrMi6SdoHaBEPHvbJet9C1d/sJcHKdw9Jnccgh a29Au9rfoOK7HbNhFiayTfxXHuAXg0uIuat+ZXSryHGb45cgEpSffgxdHujYAdaeE6Py 3sFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Us8bqfBb; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 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 lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id q7si2153781edk.133.2017.09.21.15.52.13; Thu, 21 Sep 2017 15:52:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Us8bqfBb; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 39249C21E44; Thu, 21 Sep 2017 22:52:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id ED9E6C21C29; Thu, 21 Sep 2017 22:52:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 75426C21C29; Thu, 21 Sep 2017 22:52:03 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.denx.de (Postfix) with ESMTPS id 98D88C21C26 for ; Thu, 21 Sep 2017 22:52:02 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id q132so7139427lfe.5 for ; Thu, 21 Sep 2017 15:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Bed68ixEI4wnY+sDy3Zlvd8AeH/xjgVEr3oefmLHjF0=; b=Us8bqfBbzhsG0GVxdOdjwpbB9ECEGf0SBgWiPBZGlldfJr38TY8pzjTif1SWZOEnjK OxeF8pqLa8XZq3gO+N/8FKvSN5LwGJb/Q24dDZUamazwGEhMfSa/rkgd4sIoxh0hYe4E mhU/NWPkQLqCW2zwnDh//UBfMpLw2d2CHv/ew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Bed68ixEI4wnY+sDy3Zlvd8AeH/xjgVEr3oefmLHjF0=; b=t+R7Qqy8Y/aOoRlelpfLBG4hKsL3MsLOo0hyKV1RVE72HvWEnS7EnzBRb4ftZlz4Ra J3JpZ0MiiF7xaAf13SbZJzIvxjl3GXLlrpWT4kkaV5PDV8HOwqBoZaCtFbKy8zV+uTa5 YKfPxOWsKaWDOKZL6qKOh0N1hpTO8kxlx9bCP6qTLrzpCZTRzVVqCrFf0derzO8QoWep z2JrGeyDPe7e5ggvDNodL0tSyzMz4NLjO2UikAJjkmRcuO6Zyvx2q3sf1o+wJCsVJlI7 GP4PLRkjJqSpPgbbveZIdsXbR/kbhxMrPktm3M9rLtrpZ6KaaKkiuBJwTT3kQel2+0yZ h/jg== X-Gm-Message-State: AHPjjUjkKYJBjgHb5gPuf6iU2xBsnh7mMER5LPfnvotJN80/3KW1+VP2 8Aox4qc3kNRfqIUpuUfQ84cLH4shilQ= X-Google-Smtp-Source: AOwi7QDsPvEmOylINgRCKWCuvchO7lFhqVM7tqHN40pQhGzilYbuO45JzGo8RD9Es3rrBfeqQbSlIw== X-Received: by 10.25.219.18 with SMTP id s18mr1158238lfg.232.1506034321627; Thu, 21 Sep 2017 15:52:01 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id t63sm513991lje.81.2017.09.21.15.51.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Sep 2017 15:52:00 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Fri, 22 Sep 2017 01:51:58 +0300 Message-Id: <20170921225159.2546-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.14.1 Cc: Praneeth Bajjuri , Tom Rini Subject: [U-Boot] [PATCH 1/2] disk: Provide API to get partition by name for specific type X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There is already existing function part_get_info_by_name(). But sometimes user is particularly interested in looking for only specific partition type. This patch implements such an API that provides partition searching by name for specified partition type. Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass --- disk/part.c | 15 +++++++++++++-- include/part.h | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/disk/part.c b/disk/part.c index aa9183d696..66b8101f98 100644 --- a/disk/part.c +++ b/disk/part.c @@ -21,6 +21,9 @@ #define PRINTF(fmt,args...) #endif +/* Check all partition types */ +#define PART_TYPE_ALL -1 + DECLARE_GLOBAL_DATA_PTR; #ifdef HAVE_BLOCK_DEVICE @@ -626,8 +629,8 @@ cleanup: return ret; } -int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, - disk_partition_t *info) +int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name, + disk_partition_t *info, int part_type) { struct part_driver *first_drv = ll_entry_start(struct part_driver, part_driver); @@ -638,6 +641,8 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, int ret; int i; for (i = 1; i < part_drv->max_entries; i++) { + if (part_type >= 0 && part_type != part_drv->part_type) + break; ret = part_drv->get_info(dev_desc, i, info); if (ret != 0) { /* no more entries in table */ @@ -652,6 +657,12 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, return -1; } +int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, + disk_partition_t *info) +{ + return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL); +} + void part_set_generic_name(const struct blk_desc *dev_desc, int part_num, char *name) { diff --git a/include/part.h b/include/part.h index 86117a7ce5..1a61518722 100644 --- a/include/part.h +++ b/include/part.h @@ -173,6 +173,21 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, struct blk_desc **dev_desc, disk_partition_t *info, int allow_whole_dev); +/** + * part_get_info_by_name_type() - Search for a partition by name + * for only specified partition type + * + * @param dev_desc - block device descriptor + * @param gpt_name - the specified table entry name + * @param info - returns the disk partition info + * @param part_type - only search in partitions of this type + * + * @return - the partition number on match (starting on 1), -1 on no match, + * otherwise error + */ +int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name, + disk_partition_t *info, int part_type); + /** * part_get_info_by_name() - Search for a partition by name * among all available registered partitions From patchwork Thu Sep 21 22:51:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 113935 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2567631qgf; Thu, 21 Sep 2017 15:52:57 -0700 (PDT) X-Received: by 10.80.152.33 with SMTP id g30mr2676175edb.49.1506034377627; Thu, 21 Sep 2017 15:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506034377; cv=none; d=google.com; s=arc-20160816; b=ne1Y7lOXlNHIKkG1Z4Vuq1ecvVgQjiswS04hEsU4Um7ol81FMuvWcLluW1CPNzIL7v PvE3D5YoGwiNCmWTXTY5255QDY/EdEm+GeF7oxYeFr9WoHzQddwdo4Jhdumvb+x1CcW2 UvXUnFmYMQYS5xak65rirTnmhoRcgOFezxDyYYuQfK+msTvfp78OcXYdlu5VDgTkFnpO rSyRCk6M70xB2i4lRDMwd1+jN/wGrt9NJsxDLllFFUvLBYuksANT/9kVI4W+Q9cltpvT 8Smfag8yv82xuhYa62H9ljsxP4zxBQvNPjxV4hVgZs6b/iEvUqyWQ5yknqsZxs+mx6rm 7IBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=KPucdlt6Q2rra5K5833yPOpO7IjMwuRZTLfVOof+M78=; b=kQy47z1ROS92SVhcyTT/VK/3klCsIaBMxIifqjpZ2qQWKLKvaBQZqeN3fovNyF7MRR tNpEVHetE5rxdHZd472B5DJmbC6HN41lRiqPloz44GHBhQt2057icp6pstrUnxn5nIgN Z9ooYcbapYB4fAtjTve22R7ECvAkV9hEKhfYBkpfsqN8PiNUXNQ6r4NPqo1yIkIrI/6R RInhcDoyU/DAsTsXIKCyDpg+4DA/ByNBvmwDfcBiH0wLAHumdbVivBHjM+HIE4DpNc2L VqEJ1yOKrO9UoMTX/5dV36hJpoX2K9k1N5jkbC/Ys6gHUliSxogBi4IeU28BsOSxyDG2 yq8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=feoQkxPr; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 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 lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id h9si2408134edk.169.2017.09.21.15.52.57; Thu, 21 Sep 2017 15:52:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=feoQkxPr; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 43EF9C21F4A; Thu, 21 Sep 2017 22:52:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C8A07C21E3C; Thu, 21 Sep 2017 22:52:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 68C2CC21C29; Thu, 21 Sep 2017 22:52:07 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.denx.de (Postfix) with ESMTPS id 2BA2BC21C58 for ; Thu, 21 Sep 2017 22:52:04 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id c80so7148897lfh.0 for ; Thu, 21 Sep 2017 15:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c0dxt+TYZXtDKJpYD7iwFkMs1a6eCNy1dNu9iNHdtyc=; b=feoQkxPr+TiqU/Z0+OfBBw8icwUOQalQzKQJfYFXHhoSKm0K3rCyZMPS810CZt/+fT K4aBIQuucwZJ3NPZsxPfDXbejw045OgnGQnKbZnlrVjQC0sPwl3La8qdNvlvqqRo0zyJ O4EniFGdOAQ89XWLN3PSMGyPRzRS+IpED1zgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c0dxt+TYZXtDKJpYD7iwFkMs1a6eCNy1dNu9iNHdtyc=; b=tmlzzvMCr/CUO8FjvW7Xr7k4GA+oL+tENuev+adjG+XGZ4JUZScJRbDiz7vM2Ux20X EQboPUCmeUbsndym9ek6DRYGb0QpUbChzgDFkMyTO2YCNCllYQG81lTxxcuXJoG0phMu ADSySZtN9EmTziQv9yEMZ1wZWyaOj+wRWHolOzUQ30gGtHeLDCPj44zTIRL6+ZRQrZpE nHCYwIfCk30qMH5IyYNNmZSM8PZ8J2tKIGMl/uf0aZS72THmPxP6SArlo+KBZWHr2p/9 knJMwBIImWq3fLei3VwzTSozf5sncyxeOiAsgSG7xoSxxel4BWfgsI2eGW5o3aCW93m5 K3uQ== X-Gm-Message-State: AHPjjUivk7HWVXTZov3/9shnH1ngGFmkSL5w9DF9JouDpW/shu7MWVF4 s8Oz8uWj0mmbx4THV1wjNLWi6MiR9Yc= X-Google-Smtp-Source: AOwi7QDK7b24QyRoDH5aMJw2ha+lLX88fTiAkqXgAY5QitpYwZRh6vaYLkxkXBKIfyt9M0YhAHRKVQ== X-Received: by 10.25.87.138 with SMTP id l132mr1221419lfb.26.1506034323336; Thu, 21 Sep 2017 15:52:03 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id i2sm514214ljb.20.2017.09.21.15.52.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Sep 2017 15:52:02 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Fri, 22 Sep 2017 01:51:59 +0300 Message-Id: <20170921225159.2546-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170921225159.2546-1-semen.protsenko@linaro.org> References: <20170921225159.2546-1-semen.protsenko@linaro.org> Cc: Praneeth Bajjuri , Tom Rini Subject: [U-Boot] [PATCH 2/2] omap: Fix warning when looking for userdata part X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When eMMC was formattaed for Linux partition table, "userdata" partition is missing. In this case, part_get_info_by_name() iterates over all registered drivers (which are PART_TYPE_EFI, PART_TYPE_DOS and PART_TYPE_ISO). And when it comes to PART_TYPE_ISO (which has empty partition table), we can see next warning in U-Boot output: ** First descriptor is NOT a primary desc on 1:1 ** This patch switches to part_get_info_by_name_type() API in order to check only EFI partitions for "userdata" partitions. This eliminates mentioned warning. Signed-off-by: Sam Protsenko Reviewed-by: Simon Glass --- arch/arm/mach-omap2/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c index 3892853c7e..e36dd8398f 100644 --- a/arch/arm/mach-omap2/utils.c +++ b/arch/arm/mach-omap2/utils.c @@ -91,7 +91,8 @@ static u32 omap_mmc_get_part_size(const char *part) return 0; } - res = part_get_info_by_name(dev_desc, part, &info); + /* Check only for EFI (GPT) partition table */ + res = part_get_info_by_name_type(dev_desc, part, &info, PART_TYPE_EFI); if (res < 0) return 0;