summaryrefslogtreecommitdiff
path: root/sys/dev/pci/piixpm.c
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-01-15 10:28:18 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-01-15 10:28:18 +0000
commit2ff294f1b2d08257fa18966165e6e2d28810136e (patch)
treebd0dd8984f1733e3db04be89a055047740fed761 /sys/dev/pci/piixpm.c
parent7cb21437ce6acbba8ec9be80f0347045282fe62d (diff)
In iic_exec don't fail immediately if bus is already busy. It might be
running a BIOS' transfer so wait a bit and try again.
Diffstat (limited to 'sys/dev/pci/piixpm.c')
-rw-r--r--sys/dev/pci/piixpm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/piixpm.c b/sys/dev/pci/piixpm.c
index 1ead1f0bcf4..446b44d7516 100644
--- a/sys/dev/pci/piixpm.c
+++ b/sys/dev/pci/piixpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piixpm.c,v 1.16 2006/01/15 10:04:39 grange Exp $ */
+/* $OpenBSD: piixpm.c,v 1.17 2006/01/15 10:28:17 grange Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -198,8 +198,13 @@ piixpm_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
DPRINTF(("%s: exec: op %d, addr 0x%x, cmdlen %d, len %d, flags 0x%x\n",
sc->sc_dev.dv_xname, op, addr, cmdlen, len, flags));
- /* Check if there's a transfer already running */
- st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PIIX_SMB_HS);
+ /* Wait for bus to be idle */
+ for (retries = 100; retries > 0; retries--) {
+ st = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PIIX_SMB_HS);
+ if (!(st & PIIX_SMB_HS_BUSY))
+ break;
+ DELAY(PIIXPM_DELAY);
+ }
DPRINTF(("%s: exec: st 0x%b\n", sc->sc_dev.dv_xname, st,
PIIX_SMB_HS_BITS));
if (st & PIIX_SMB_HS_BUSY)