From patchwork Tue Apr 29 22:31:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Rae X-Patchwork-Id: 29379 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C1C3F202FE for ; Tue, 29 Apr 2014 22:27:54 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf4477307obc.9 for ; Tue, 29 Apr 2014 15:27:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=rb1R31tYNcPIEnw8u1ZvqSvuPNTZsollwzdTP6lBi+w=; b=OOUlu6mN5PUNV9DcEZybJGybBdk9U2MVdnH4o615ZvaxMg1p2mEYbtKGDnHDZbvjwS LRgnU05y1aaL3CXG8gqEPIbVOsnS9vBGTSTCgBZI6xruL+JSMq1hJWCQ3S6v/2L54qjA KOlh7u5zkd2ENBQMPl9O+rzookcrUq31Io5aSF8qjUXQtRAgOa5vEZFDwU23WmGonth1 DXvK4trnsNhBF0n3+yOU6jx44VEsJyrJrvYgyItzpQfHGF1JZhUprdkOM1DSNhsWhJKr +U9bV/feKzjLh4AleNFAWThYjZPxqNocSkUPSCtoKdhRa17OUxslfj0Mnos30wgO4SiY ukUA== X-Gm-Message-State: ALoCoQkLrIypnxBWlbyPuiqwpqqO8sEehxZ5S3LOlfZ4bLohrjN/pyQcShOd67nSL2sqZEAwxzT5 X-Received: by 10.50.39.80 with SMTP id n16mr381887igk.2.1398810473932; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.201 with SMTP id e67ls370945qgf.94.gmail; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) X-Received: by 10.52.104.72 with SMTP id gc8mr302655vdb.48.1398810473803; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id ls10si4882377vec.172.2014.04.29.15.27.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 15:27:53 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so1107792veb.5 for ; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) X-Received: by 10.220.4.132 with SMTP id 4mr323132vcr.9.1398810473669; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp232027vcb; Tue, 29 Apr 2014 15:27:53 -0700 (PDT) X-Received: by 10.14.207.68 with SMTP id m44mr316824eeo.79.1398810472513; Tue, 29 Apr 2014 15:27:52 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id 43si28453702eei.235.2014.04.29.15.27.51 for ; Tue, 29 Apr 2014 15:27:52 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C5A84B92A; Wed, 30 Apr 2014 00:27:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CogYvZtNYX8V; Wed, 30 Apr 2014 00:27:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2C42E4B8B1; Wed, 30 Apr 2014 00:27:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 62FC14B8B1 for ; Wed, 30 Apr 2014 00:27:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BBXmyfMXop5o for ; Wed, 30 Apr 2014 00:27:40 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gw3-out.broadcom.com (mail-gw3-out.broadcom.com [216.31.210.64]) by theia.denx.de (Postfix) with ESMTP id 5E3FE4B8A4 for ; Wed, 30 Apr 2014 00:27:37 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.97,953,1389772800"; d="scan'208";a="26729103" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw3-out.broadcom.com with ESMTP; 29 Apr 2014 15:47:41 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 29 Apr 2014 15:27:29 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Tue, 29 Apr 2014 15:27:30 -0700 Received: from mail.broadcom.com (lbrmn-vmlnx03.ric.broadcom.com [10.136.4.105]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 6476651E7D; Tue, 29 Apr 2014 15:27:29 -0700 (PDT) From: Steve Rae To: , Albert Aribaud , "Tom Rini" Date: Tue, 29 Apr 2014 15:31:43 -0700 Message-ID: <1398810703-29467-1-git-send-email-srae@broadcom.com> X-Mailer: git-send-email 1.8.5 MIME-Version: 1.0 Subject: [U-Boot] [PATCH] disk: part_efi: add support for the Alternate GPT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srae@broadcom.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Check the Alternate GPT table if the Primary GPT table is invalid. Signed-off-by: Steve Rae --- disk/part_efi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index 216a292..ad899fa 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -93,7 +93,15 @@ void print_part_efi(block_dev_desc_t * dev_desc) if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, &gpt_pte) != 1) { printf("%s: *** ERROR: Invalid GPT ***\n", __func__); - return; + if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), + gpt_head, &gpt_pte) != 1) { + printf("%s: *** ERROR: Invalid Alternate GPT ***\n", + __func__); + return; + } else { + printf("%s: *** Using Alternate GPT ***\n", + __func__); + } } debug("%s: gpt-entry at %p\n", __func__, gpt_pte); @@ -142,7 +150,15 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part, if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, &gpt_pte) != 1) { printf("%s: *** ERROR: Invalid GPT ***\n", __func__); - return -1; + if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), + gpt_head, &gpt_pte) != 1) { + printf("%s: *** ERROR: Invalid Alternate GPT ***\n", + __func__); + return -1; + } else { + printf("%s: *** Using Alternate GPT ***\n", + __func__); + } } if (part > le32_to_cpu(gpt_head->num_partition_entries) ||