Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 2015 15:49:54 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288372 - head/sys/boot/efi/loader
Message-ID:  <201509291549.t8TFns1o048595@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Sep 29 15:49:53 2015
New Revision: 288372
URL: https://svnweb.freebsd.org/changeset/base/288372

Log:
  Use EFI page size constants instead of hardcoding 4096.
  
  Reviewed by:	emaste
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D3692

Modified:
  head/sys/boot/efi/loader/copy.c

Modified: head/sys/boot/efi/loader/copy.c
==============================================================================
--- head/sys/boot/efi/loader/copy.c	Tue Sep 29 15:47:42 2015	(r288371)
+++ head/sys/boot/efi/loader/copy.c	Tue Sep 29 15:49:53 2015	(r288372)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 #define	EFI_STAGING_SIZE	48
 #endif
 
-#define	STAGE_PAGES	((EFI_STAGING_SIZE) * 1024 * 1024 / 4096)
+#define	STAGE_PAGES	EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024)
 
 EFI_PHYSICAL_ADDRESS	staging, staging_end;
 int			stage_offset_set = 0;
@@ -59,7 +59,7 @@ efi_copy_init(void)
 		    (unsigned long)(status & EFI_ERROR_MASK));
 		return (status);
 	}
-	staging_end = staging + STAGE_PAGES * 4096;
+	staging_end = staging + STAGE_PAGES * EFI_PAGE_SIZE;
 
 #if defined(__aarch64__) || defined(__arm__)
 	/*
@@ -132,7 +132,7 @@ efi_copy_finish(void)
 
 	src = (uint64_t *)staging;
 	dst = (uint64_t *)(staging - stage_offset);
-	last = (uint64_t *)(staging + STAGE_PAGES * EFI_PAGE_SIZE);
+	last = (uint64_t *)staging_end;
 
 	while (src < last)
 		*dst++ = *src++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509291549.t8TFns1o048595>