Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Use roundup2() instead of open coding some...



details:   https://anonhg.NetBSD.org/src/rev/9512fc1e2fb4
branches:  trunk
changeset: 454787:9512fc1e2fb4
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Sep 27 20:10:42 2019 +0000

description:
Use roundup2() instead of open coding something almost the same that
truncates 64-bit quantities.

Fixes disk access and booting in bootaa64.efi on SoftIron OverDrive 1000
(which does not have any memory below 4GiB).

diffstat:

 sys/stand/efiboot/efiblock.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r 6dd5772c7fa2 -r 9512fc1e2fb4 sys/stand/efiboot/efiblock.c
--- a/sys/stand/efiboot/efiblock.c      Fri Sep 27 20:05:53 2019 +0000
+++ b/sys/stand/efiboot/efiblock.c      Fri Sep 27 20:10:42 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.6 2019/09/21 10:19:37 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.7 2019/09/27 20:10:42 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -108,8 +108,8 @@
                *buf_start = buf = AllocatePool(size);
        else {
                buf = AllocatePool(size + bdev->bio->Media->IoAlign - 1);
-               *buf_start = (buf == NULL) ? NULL : (void *)(((intptr_t)buf +
-                       bdev->bio->Media->IoAlign - 1) & ~(bdev->bio->Media->IoAlign - 1));
+               *buf_start = (buf == NULL) ? NULL :
+                   (void *)roundup2((intptr_t)buf, bdev->bio->Media->IoAlign);
        }
 
        return buf;



Home | Main Index | Thread Index | Old Index