summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Derksen <v2cibmd@us.ibm.com>2016-04-22 13:29:04 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-04-26 16:11:27 -0400
commitc2416320859fbbacb6386a4a6fa0a81d3f1aebab (patch)
tree32e7b8f0c4356da589355db8fc03f97f34f5ff96
parent84245de79e62f285cd4bd3201dcf8ec8c92d1f42 (diff)
downloadtalos-hostboot-c2416320859fbbacb6386a4a6fa0a81d3f1aebab.tar.gz
talos-hostboot-c2416320859fbbacb6386a4a6fa0a81d3f1aebab.zip
Fix compiler warning/error for p9_io_gcr.H
Change-Id: I289d3555723c3ce4fc47caf63cdb9deba611ffa6 RTC:146576 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23589 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23592 Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/import/chips/p9/procedures/hwp/io/p9_io_gcr.H12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/import/chips/p9/procedures/hwp/io/p9_io_gcr.H b/src/import/chips/p9/procedures/hwp/io/p9_io_gcr.H
index 6496c2d76..d00feaca5 100644
--- a/src/import/chips/p9/procedures/hwp/io/p9_io_gcr.H
+++ b/src/import/chips/p9/procedures/hwp/io/p9_io_gcr.H
@@ -160,9 +160,15 @@ class Register
inline void set(const uint16_t i_data)
{
static_assert(FIELD_ID == REG_ID, "Field does not belong to Register");
- const uint8_t shift = REG_WIDTH - START - WIDTH;
- const uint64_t mask = ( (0x1 << WIDTH) - 1) << shift;
- set((_shadow & ~mask) | ((i_data << shift) & mask));
+ uint8_t shift = REG_WIDTH - START - WIDTH;
+
+ // Boundary check to avoid shifting off the edge compiler warning
+ if ( (shift + WIDTH) < 64 )
+ {
+ const uint64_t mask = ((0x1 << WIDTH) - 1) << shift;
+ set((_shadow & ~mask) | ((i_data << shift) & mask));
+ }
+
return;
}
OpenPOWER on IntegriCloud