From 9611008eb6768fc2d23a82560d75f43f101298b6 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Thu, 12 Feb 2015 15:16:11 -0600 Subject: Align all HBRT reserved memory to 64K boundary Change-Id: Ifcc3afa30ed84189cf10c1a8df9a7b4e7d38ffea RTC: 123657 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15711 Reviewed-by: Andrew J. Geissler Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/include/usr/vmmconst.h | 6 ++++-- src/include/util/align.H | 41 +++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'src/include') diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h index 759114670..b78c675b8 100644 --- a/src/include/usr/vmmconst.h +++ b/src/include/usr/vmmconst.h @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -141,7 +143,7 @@ enum BlockPriority /** Reserved runtime VPD sizes in bytes */ -// must be page aligned +// must be 64KB aligned #define VMM_MODULE_VPD_SIZE 0x80000 #define VMM_CENTAUR_VPD_SIZE 0x40000 #define VMM_DIMM_JEDEC_VPD_SIZE 0x40000 diff --git a/src/include/util/align.H b/src/include/util/align.H index 71e1f5e0f..0ffec92d1 100644 --- a/src/include/util/align.H +++ b/src/include/util/align.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -25,29 +27,28 @@ #include -// Return a number >= input that is aligned up to the next 4-byte boundary -#define ALIGN_4(u) (((u) + 0x3ull) & ~0x3ull) - -// Return a number <= input that is rounded down to nearest 4-byte boundary -#define ALIGN_DOWN_4(u) ((u) & ~3ull) - -// Return a number >= input that is aligned up to the next 8-byte bounday -#define ALIGN_8(u) (((u) + 0x7ull) & ~0x7ull) - -// Return a number <= input that is rounded down to nearest 8-byte boundary -#define ALIGN_DOWN_8(u) ((u) & ~7ull) +// Return a number >= input that is aligned up to the next x boundary, +// where x is a power of 2. +#define ALIGN_X(u,x) (((u) + ((x)-1)) & ~((x)-1)) -// Return a number >= input that is aligned up to the next page boundary -#define ALIGN_PAGE(u) (((u) + (PAGESIZE-1)) & ~(PAGESIZE-1)) +// Return a number <= input that is aligned on a x boundary, where x +// is a power of 2. +#define ALIGN_DOWN_X(u,x) ((u) - (u)%(x)) -// Return a number <= input that is aligned on a page boundary -#define ALIGN_PAGE_DOWN(u) ((u) - (u)%PAGESIZE) +// Useful shortcut macros for 4. +#define ALIGN_4(u) (ALIGN_X(u,4)) +#define ALIGN_DOWN_4(u) (ALIGN_DOWN_X(u,4)) -// Return a number >= input that is aligned up to the next MB boundary -#define ALIGN_MEGABYTE(u) (((u) + (MEGABYTE-1)) & ~(MEGABYTE-1)) +// Useful shortcut macros for 8. +#define ALIGN_8(u) (ALIGN_X(u,8)) +#define ALIGN_DOWN_8(u) (ALIGN_DOWN_X(u,8)) -// Return a number <= input that is aligned on a MB boundary -#define ALIGN_MEGABYTE_DOWN(u) ((u) - (u)%MEGABYTE) +// Useful shortcut macros for a page. +#define ALIGN_PAGE(u) (ALIGN_X(u,PAGESIZE)) +#define ALIGN_PAGE_DOWN(u) (ALIGN_DOWN_X(u,PAGESIZE)) +// Useful shortcut macros for a MB. +#define ALIGN_MEGABYTE(u) (ALIGN_X(u,MEGABYTE)) +#define ALIGN_MEGABYTE_DOWN(u) (ALIGN_DOWN_X(u,MEGABYTE)) #endif -- cgit v1.2.1