aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-08-30 22:36:06 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-30 20:22:25 -0500
commitb73d15fa328ee242102dce4f7cda1cc650c787aa (patch)
tree51bb1b7471bf95906ff2576049e70b921907015a /hw/p8-i2c.c
parentd5fa66c74a194022a5254622a58f967ac4955bc3 (diff)
downloadskiboot-b73d15fa328ee242102dce4f7cda1cc650c787aa.zip
skiboot-b73d15fa328ee242102dce4f7cda1cc650c787aa.tar.gz
skiboot-b73d15fa328ee242102dce4f7cda1cc650c787aa.tar.bz2
p8-i2c: Fix random data corruption
While waiting for the OCC to signal that it has finished using the I2C master we put the master into the, poorly named, occache_dis state. While in this state the transaction hasn't been started, but p8_i2c_check_status() will only skip it's checks when the master is in the idle state. Any action that checks that cranks the I2C state machine (interrupt, poll, etc) will call p8_i2c_check_status() and since the master is not idle, it will check the status register, see the transaction complete flag set and complete the i2c request without actually doing anything. If the transaction was a I2C read, the resulting output will be a zeroed data buffer. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index a627417..9cc016f 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -892,7 +892,7 @@ static void p8_i2c_check_status(struct p8_i2c_master *master)
/* If we are idle, just return, we'll catch error conditions
* when we next try to enqueue a request
*/
- if (master->state == state_idle)
+ if (master->state == state_idle || master->state == state_occache_dis)
return;
/* Read status register */