summaryrefslogtreecommitdiffstats
path: root/hw/i2c/smbus_ich9.c
diff options
context:
space:
mode:
authorCorey Minyard2018-08-20 22:26:04 +0200
committerPaolo Bonzini2018-08-23 18:46:25 +0200
commit38ad4fae43b9c57a4ef3111217b110b25dbd3c50 (patch)
treea86604f02e39e2d4ac4c2a56d87aa22a1a2c6eee /hw/i2c/smbus_ich9.c
parenti2c: pm_smbus: Make the I2C block read command read-only (diff)
downloadqemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.tar.gz
qemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.tar.xz
qemu-38ad4fae43b9c57a4ef3111217b110b25dbd3c50.zip
i2c: pm_smbus: Add block transfer capability
There was no block transfer code in pm_smbus.c, and it is needed for some devices. So add it. This adds both byte-by-byte block transfers and buffered block transfers. Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1534796770-10295-5-git-send-email-minyard@acm.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i2c/smbus_ich9.c')
-rw-r--r--hw/i2c/smbus_ich9.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 007cb6701d..a66a1144c5 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -61,12 +61,16 @@ static void ich9_smbus_write_config(PCIDevice *d, uint32_t address,
pci_default_write_config(d, address, val, len);
if (range_covers_byte(address, len, ICH9_SMB_HOSTC)) {
uint8_t hostc = s->dev.config[ICH9_SMB_HOSTC];
- if ((hostc & ICH9_SMB_HOSTC_HST_EN) &&
- !(hostc & ICH9_SMB_HOSTC_I2C_EN)) {
+ if (hostc & ICH9_SMB_HOSTC_HST_EN) {
memory_region_set_enabled(&s->smb.io, true);
} else {
memory_region_set_enabled(&s->smb.io, false);
}
+ s->smb.i2c_enable = (hostc & ICH9_SMB_HOSTC_I2C_EN) != 0;
+ if (hostc & ICH9_SMB_HOSTC_SSRESET) {
+ s->smb.reset(&s->smb);
+ s->dev.config[ICH9_SMB_HOSTC] &= ~ICH9_SMB_HOSTC_SSRESET;
+ }
}
}