diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2015-02-12 15:16:11 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-16 15:30:40 -0600 |
commit | 9611008eb6768fc2d23a82560d75f43f101298b6 (patch) | |
tree | 9846bb1665f50f783158731cf2335830ceb01b05 /src | |
parent | 0b03c03b42b899fbad17c3aa2f0b0b55c21bd60b (diff) | |
download | talos-hostboot-9611008eb6768fc2d23a82560d75f43f101298b6.tar.gz talos-hostboot-9611008eb6768fc2d23a82560d75f43f101298b6.zip |
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 <andrewg@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/vmmconst.h | 6 | ||||
-rw-r--r-- | src/include/util/align.H | 41 | ||||
-rw-r--r-- | src/usr/devtree/bld_devtree.C | 2 | ||||
-rw-r--r-- | src/usr/targeting/attrrp.C | 2 |
4 files changed, 29 insertions, 22 deletions
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 <limits.h> -// 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 diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C index f1b0fb0da..908ce6e1f 100644 --- a/src/usr/devtree/bld_devtree.C +++ b/src/usr/devtree/bld_devtree.C @@ -857,6 +857,8 @@ void load_hbrt_image(uint64_t& io_address) TRACFCOMP(g_trac_devtree, "HBRT image: start = %lx, size = %lx", image_start, image_size); io_address -= ALIGN_PAGE(image_size); + // Align to 64KB for Opal + io_address = ALIGN_DOWN_X(io_address,64*KILOBYTE); // Copy image. void* memArea = mm_block_map(reinterpret_cast<void*>(io_address), diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index 6c499e629..fbf61b892 100644 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -505,6 +505,8 @@ namespace TARGETING // Determine bottom of the address region. io_addr = io_addr - l_size; + // Align to 64KB for Opal + io_addr = ALIGN_DOWN_X(io_addr,64*KILOBYTE); // Map in region. |