blob: d7da48056ea8efce3aabb401134dbe5e821597c0 [file] [log] [blame]
Patrick Williams0ac3e2d2015-03-31 14:51:41 -05001From 4c31ecf3b63f4f21e677d7359f64de22cd8fc1eb Mon Sep 17 00:00:00 2001
2From: Mike Baiocchi <baiocchi@us.ibm.com>
3Date: Wed, 18 Mar 2015 10:31:21 -0500
4Subject: [PATCH] Initialize I2C Switches in struct to zero
5
6There are multiple uses for the I2C Switches in the misc_args_t
7struct used in I2C operations. The struct was not defaulting the
8switches value to zero and there were negative consequences of this
9early in the IPL for the i2cPresence() function.
10
11Fixes open-power/hostboot#18
12
13Change-Id: I83d34770ff04cfe31bf07b320d8821c8fa80c705
14CQ: SW2999529
15Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16447
16Tested-by: Jenkins Server
17Reviewed-by: MATTHEW A. PLOETZ <maploetz@us.ibm.com>
18Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
19Reviewed-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
25diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
26index 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,
40diff --git a/src/usr/i2c/i2c_common.H b/src/usr/i2c/i2c_common.H
41index 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--
572.3.0
58