Patrick Williams | 0ac3e2d | 2015-03-31 14:51:41 -0500 | [diff] [blame] | 1 | From 4c31ecf3b63f4f21e677d7359f64de22cd8fc1eb Mon Sep 17 00:00:00 2001 |
| 2 | From: Mike Baiocchi <baiocchi@us.ibm.com> |
| 3 | Date: Wed, 18 Mar 2015 10:31:21 -0500 |
| 4 | Subject: [PATCH] Initialize I2C Switches in struct to zero |
| 5 | |
| 6 | There are multiple uses for the I2C Switches in the misc_args_t |
| 7 | struct used in I2C operations. The struct was not defaulting the |
| 8 | switches value to zero and there were negative consequences of this |
| 9 | early in the IPL for the i2cPresence() function. |
| 10 | |
| 11 | Fixes open-power/hostboot#18 |
| 12 | |
| 13 | Change-Id: I83d34770ff04cfe31bf07b320d8821c8fa80c705 |
| 14 | CQ: SW2999529 |
| 15 | Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16447 |
| 16 | Tested-by: Jenkins Server |
| 17 | Reviewed-by: MATTHEW A. PLOETZ <maploetz@us.ibm.com> |
| 18 | Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> |
| 19 | Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> |
| 20 | --- |
| 21 | src/usr/i2c/i2c.C | 4 +++- |
| 22 | src/usr/i2c/i2c_common.H | 5 ++++- |
| 23 | 2 files changed, 7 insertions(+), 2 deletions(-) |
| 24 | |
| 25 | diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C |
| 26 | index 1f2b8a0..f8583b8 100755 |
| 27 | --- a/src/usr/i2c/i2c.C |
| 28 | +++ b/src/usr/i2c/i2c.C |
| 29 | @@ -688,7 +688,9 @@ bool i2cPresence( TARGETING::Target * i_target, |
| 30 | |
| 31 | |
| 32 | |
| 33 | - //Set Host vs FSI switches |
| 34 | + // Set I2C Mode (Host vs FSI) for the target |
| 35 | + args.switches.useHostI2C = 0; |
| 36 | + args.switches.useFsiI2C = 0; |
| 37 | i2cSetSwitches( i_target, args ); |
| 38 | |
| 39 | err = i2cSetBusVariables(i_target, |
| 40 | diff --git a/src/usr/i2c/i2c_common.H b/src/usr/i2c/i2c_common.H |
| 41 | index 68865a5..1772ea2 100644 |
| 42 | --- a/src/usr/i2c/i2c_common.H |
| 43 | +++ b/src/usr/i2c/i2c_common.H |
| 44 | @@ -75,7 +75,10 @@ struct misc_args_t |
| 45 | polling_interval_ns(0), |
| 46 | timeout_count(0), |
| 47 | offset_length(0), |
| 48 | - offset_buffer(NULL){}; |
| 49 | + offset_buffer(NULL) |
| 50 | + { |
| 51 | + memset(&switches, 0x0, sizeof(switches)); |
| 52 | + }; |
| 53 | |
| 54 | }; |
| 55 | |
| 56 | -- |
| 57 | 2.3.0 |
| 58 | |