From patchwork Thu Jan 8 11:26:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 426575 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 86CF9140119 for ; Thu, 8 Jan 2015 22:30:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE9624B600; Thu, 8 Jan 2015 12:30:11 +0100 (CET) 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 atnO7VamTrZx; Thu, 8 Jan 2015 12:30:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 474824B5E9; Thu, 8 Jan 2015 12:30:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A0034B5E9 for ; Thu, 8 Jan 2015 12:30:07 +0100 (CET) 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 2JtBQsIKBpgF for ; Thu, 8 Jan 2015 12:30:07 +0100 (CET) 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.free-electrons.com (down.free-electrons.com [37.187.137.238]) by theia.denx.de (Postfix) with ESMTP id 10E1C4B5E4 for ; Thu, 8 Jan 2015 12:30:02 +0100 (CET) Received: by mail.free-electrons.com (Postfix, from userid 106) id 531DF5AB; Thu, 8 Jan 2015 12:30:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0CCDE4BF; Thu, 8 Jan 2015 12:30:03 +0100 (CET) From: Maxime Ripard To: u-boot@lists.denx.de Date: Thu, 8 Jan 2015 12:26:44 +0100 Message-Id: <1420716404-710-1-git-send-email-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.2.1 Cc: Steve Rae , Thomas Petazzoni , Hector Palacios , Alexandre Belloni , Przemyslaw Marczak , Tom Rini Subject: [U-Boot] [PATCH] gpt: Fix the protective MBR partition size X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de According to the UEFI Spec (Table 16, section 5.2.3 of the version 2.4 Errata B), the protective MBR partition record size must be set to the size of the disk minus one, in LBAs. However, the current code was setting the size as the total number of LBAs on the disk, resulting in an off-by-one error. This confused the AM335x ROM code, and will probably confuse other tools as well. Signed-off-by: Maxime Ripard --- disk/part_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index 612f0926b62b..5ca17c138e96 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -240,7 +240,7 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc) p_mbr->signature = MSDOS_MBR_SIGNATURE; p_mbr->partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT; p_mbr->partition_record[0].start_sect = 1; - p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba; + p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba - 1; /* Write MBR sector to the MMC device */ if (dev_desc->block_write(dev_desc->dev, 0, 1, p_mbr) != 1) {