From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] part: efi: Fix offset
Date: Wed, 23 Aug 2017 16:01:30 +0200 [thread overview]
Message-ID: <20170823140133.1506-1-maxime.ripard@free-electrons.com> (raw)
Both the config option and the DT options specify the offset to set the GPT
at in bytes, yet the code treats those values as block numbers.
Fix that.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
disk/part_efi.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 71c3cb3f78d9..75d0a78f0a1f 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -534,6 +534,7 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
{
uint32_t offset_blks = 2;
+ uint32_t __maybe_unused offset_bytes;
int __maybe_unused config_offset;
#if defined(CONFIG_EFI_PARTITION_ENTRIES_OFF)
@@ -545,8 +546,9 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
* the disk) for the entries can be set in
* CONFIG_EFI_PARTITION_ENTRIES_OFF.
*/
- offset_blks =
+ offset_bytes =
PAD_TO_BLOCKSIZE(CONFIG_EFI_PARTITION_ENTRIES_OFF, dev_desc);
+ offset_blks = offset_bytes / dev_desc->blksz;
#endif
#if defined(CONFIG_OF_CONTROL)
@@ -558,8 +560,10 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
config_offset = fdtdec_get_config_int(gd->fdt_blob,
"u-boot,efi-partition-entries-offset",
-EINVAL);
- if (config_offset != -EINVAL)
- offset_blks = PAD_TO_BLOCKSIZE(config_offset, dev_desc);
+ if (config_offset != -EINVAL) {
+ offset_bytes = PAD_TO_BLOCKSIZE(config_offset, dev_desc);
+ offset_blks = offset_bytes / dev_desc->blksz;
+ }
#endif
debug("efi: partition entries offset (in blocks): %d\n", offset_blks);
--
2.13.5
next reply other threads:[~2017-08-23 14:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 14:01 Maxime Ripard [this message]
2017-08-23 14:01 ` [U-Boot] [PATCH 2/4] part: efi: rework the partition start and size in gpt_fill_pte Maxime Ripard
2017-08-25 1:05 ` Tom Rini
2017-09-04 0:41 ` [U-Boot] [U-Boot, " Tom Rini
2017-08-23 14:01 ` [U-Boot] [PATCH 3/4] part: efi: make gpt_fill_pte take the device descriptor Maxime Ripard
2017-08-25 1:05 ` Tom Rini
2017-09-04 0:41 ` [U-Boot] [U-Boot, " Tom Rini
2017-08-23 14:01 ` [U-Boot] [PATCH 4/4] part: efi: Disable overlap check Maxime Ripard
2017-08-25 1:05 ` Tom Rini
2017-09-04 0:41 ` [U-Boot] [U-Boot,4/4] " Tom Rini
2017-08-25 1:05 ` [U-Boot] [PATCH 1/4] part: efi: Fix offset Tom Rini
2017-08-28 7:01 ` Maxime Ripard
2017-08-25 11:39 ` Dr. Philipp Tomsich
2017-09-04 0:41 ` [U-Boot] [U-Boot,1/4] " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170823140133.1506-1-maxime.ripard@free-electrons.com \
--to=maxime.ripard@free-electrons.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.