diff options
author | Tom Rini <trini@konsulko.com> | 2019-06-15 13:03:00 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-06-15 13:03:00 -0400 |
commit | 77f6e2dd0551d8a825bab391a1bd6b838874bcd4 (patch) | |
tree | 757a1344868cc10d0c8ff181d76193cde55583de /disk/part.c | |
parent | f681eacbfeb2598c135ef8e8ba8d5b9298a52a38 (diff) | |
parent | 3950f0f8563acab248214df36053bb6c57b91940 (diff) |
Merge tag 'efi-2019-07-rc5-2' of git://git.denx.de/u-boot-efi
Pull request for UEFI sub-system for v2019.07-rc5 (2)
This pull request provides bug fixes for the UEFI sub-system. The most
relevant one concerns the allocation of memory at address 0. It is
needed for booting Linux on several boards via bootefi, e.g. the Asus
TinkerBoard.
An undefined reference bug in disk/part.c related to a division is
resolved.
Diffstat (limited to 'disk/part.c')
-rw-r--r-- | disk/part.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/disk/part.c b/disk/part.c index 98cc54db20..862078f3e7 100644 --- a/disk/part.c +++ b/disk/part.c @@ -103,17 +103,17 @@ typedef lbaint_t lba512_t; #endif /* - * Overflowless variant of (block_count * mul_by / div_by) + * Overflowless variant of (block_count * mul_by / 2**div_by) * when div_by > mul_by */ -static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, lba512_t div_by) +static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, int div_by) { lba512_t bc_quot, bc_rem; /* x * m / d == x / d * m + (x % d) * m / d */ - bc_quot = block_count / div_by; - bc_rem = block_count - div_by * bc_quot; - return bc_quot * mul_by + (bc_rem * mul_by) / div_by; + bc_quot = block_count >> div_by; + bc_rem = block_count - (bc_quot << div_by); + return bc_quot * mul_by + ((bc_rem * mul_by) >> div_by); } void dev_print (struct blk_desc *dev_desc) @@ -193,7 +193,7 @@ void dev_print (struct blk_desc *dev_desc) lba512 = (lba * (dev_desc->blksz/512)); /* round to 1 digit */ /* 2048 = (1024 * 1024) / 512 MB */ - mb = lba512_muldiv(lba512, 10, 2048); + mb = lba512_muldiv(lba512, 10, 11); mb_quot = mb / 10; mb_rem = mb - (10 * mb_quot); |