| From 4c31ecf3b63f4f21e677d7359f64de22cd8fc1eb Mon Sep 17 00:00:00 2001 |
| From: Mike Baiocchi <baiocchi@us.ibm.com> |
| Date: Wed, 18 Mar 2015 10:31:21 -0500 |
| Subject: [PATCH] Initialize I2C Switches in struct to zero |
| |
| There are multiple uses for the I2C Switches in the misc_args_t |
| struct used in I2C operations. The struct was not defaulting the |
| switches value to zero and there were negative consequences of this |
| early in the IPL for the i2cPresence() function. |
| |
| Fixes open-power/hostboot#18 |
| |
| Change-Id: I83d34770ff04cfe31bf07b320d8821c8fa80c705 |
| CQ: SW2999529 |
| Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16447 |
| Tested-by: Jenkins Server |
| Reviewed-by: MATTHEW A. PLOETZ <maploetz@us.ibm.com> |
| Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> |
| Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> |
| --- |
| src/usr/i2c/i2c.C | 4 +++- |
| src/usr/i2c/i2c_common.H | 5 ++++- |
| 2 files changed, 7 insertions(+), 2 deletions(-) |
| |
| diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C |
| index 1f2b8a0..f8583b8 100755 |
| --- a/src/usr/i2c/i2c.C |
| +++ b/src/usr/i2c/i2c.C |
| @@ -688,7 +688,9 @@ bool i2cPresence( TARGETING::Target * i_target, |
| |
| |
| |
| - //Set Host vs FSI switches |
| + // Set I2C Mode (Host vs FSI) for the target |
| + args.switches.useHostI2C = 0; |
| + args.switches.useFsiI2C = 0; |
| i2cSetSwitches( i_target, args ); |
| |
| err = i2cSetBusVariables(i_target, |
| diff --git a/src/usr/i2c/i2c_common.H b/src/usr/i2c/i2c_common.H |
| index 68865a5..1772ea2 100644 |
| --- a/src/usr/i2c/i2c_common.H |
| +++ b/src/usr/i2c/i2c_common.H |
| @@ -75,7 +75,10 @@ struct misc_args_t |
| polling_interval_ns(0), |
| timeout_count(0), |
| offset_length(0), |
| - offset_buffer(NULL){}; |
| + offset_buffer(NULL) |
| + { |
| + memset(&switches, 0x0, sizeof(switches)); |
| + }; |
| |
| }; |
| |
| -- |
| 2.3.0 |
| |