[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/25] smbus: do not immediately complete commands
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 25/25] smbus: do not immediately complete commands |
Date: |
Thu, 21 Dec 2017 16:31:18 +0200 |
From: Hervé Poussineau <address@hidden>
PIIX4 errata says that "immediate polling of the Host Status Register BUSY
bit may indicate that the SMBus is NOT busy."
Due to this, some code does the following steps:
(a) set parameters
(b) start command
(c) check for smbus busy bit set (to know that command started)
(d) check for smbus busy bit not set (to know that command finished)
Let (c) happen, by immediately setting the busy bit, and really executing
the command when status register has been read once.
This fixes a problem with AMIBIOS, which can now properly initialize the PIIX4.
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/i2c/pm_smbus.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 6fc3923..ec060d5 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -63,6 +63,9 @@ static void smb_transaction(PMSMBus *s)
I2CBus *bus = s->smbus;
int ret;
+ assert(s->smb_stat & STS_HOST_BUSY);
+ s->smb_stat &= ~STS_HOST_BUSY;
+
SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
/* Transaction isn't exec if STS_DEV_ERR bit set */
if ((s->smb_stat & STS_DEV_ERR) != 0) {
@@ -135,6 +138,13 @@ error:
}
+static void smb_transaction_start(PMSMBus *s)
+{
+ /* Do not execute immediately the command ; it will be
+ * executed when guest will read SMB_STAT register */
+ s->smb_stat |= STS_HOST_BUSY;
+}
+
static void smb_ioport_writeb(void *opaque, hwaddr addr, uint64_t val,
unsigned width)
{
@@ -150,7 +160,7 @@ static void smb_ioport_writeb(void *opaque, hwaddr addr,
uint64_t val,
case SMBHSTCNT:
s->smb_ctl = val;
if (val & 0x40)
- smb_transaction(s);
+ smb_transaction_start(s);
break;
case SMBHSTCMD:
s->smb_cmd = val;
@@ -182,6 +192,10 @@ static uint64_t smb_ioport_readb(void *opaque, hwaddr
addr, unsigned width)
switch(addr) {
case SMBHSTSTS:
val = s->smb_stat;
+ if (s->smb_stat & STS_HOST_BUSY) {
+ /* execute command now */
+ smb_transaction(s);
+ }
break;
case SMBHSTCNT:
s->smb_index = 0;
--
MST
- [Qemu-devel] [PULL 13/25] tests/pxe-test: Test net booting over IPv6 in some cases, (continued)
- [Qemu-devel] [PULL 13/25] tests/pxe-test: Test net booting over IPv6 in some cases, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 16/25] hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 17/25] hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 18/25] hw/pci: remove obsolete PCIDevice->init(), Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 19/25] vhost-user: fix indentation in protocol specification, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 20/25] vhost-user: document memory accesses, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 23/25] virtio-pci: Don't force Subsystem Vendor ID = Vendor ID, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 25/25] smbus: do not immediately complete commands,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 24/25] dump-guest-memory.py: fix "You can't do that without a process to debug", Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 21/25] intel_iommu: remove X86_IOMMU_PCI_DEVFN_MAX, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 22/25] intel_iommu: fix error param in string, Michael S. Tsirkin, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Peter Maydell, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Peter Maydell, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Philippe Mathieu-Daudé, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Philippe Mathieu-Daudé, 2017/12/21
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2017/12/21