Module Name:    src
Committed By:   jakllsch
Date:           Fri Sep 27 20:10:43 UTC 2019

Modified Files:
        src/sys/stand/efiboot: efiblock.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/stand/efiboot/efiblock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/efiblock.c
diff -u src/sys/stand/efiboot/efiblock.c:1.6 src/sys/stand/efiboot/efiblock.c:1.7
--- src/sys/stand/efiboot/efiblock.c:1.6	Sat Sep 21 10:19:37 2019
+++ src/sys/stand/efiboot/efiblock.c	Fri Sep 27 20:10:42 2019
@@ -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 <non...@netbsd.org>
@@ -108,8 +108,8 @@ efi_block_allocate_device_buffer(struct 
 		*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;

Reply via email to