summaryrefslogtreecommitdiffstats
path: root/sys/dev/amr
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-03-23 18:33:19 +0000
committermsmith <msmith@FreeBSD.org>2000-03-23 18:33:19 +0000
commit2054c7bab47b0600e4308a6dd0d6d9f7605067ee (patch)
tree748794e9e4675cd48d8499df036d1faa3f4c1be6 /sys/dev/amr
parentf3ae48fd505aa13a32ee063d82a80ed52e7a298f (diff)
downloadFreeBSD-src-2054c7bab47b0600e4308a6dd0d6d9f7605067ee.zip
FreeBSD-src-2054c7bab47b0600e4308a6dd0d6d9f7605067ee.tar.gz
Fix detection of the card-ready-for-command state. Use an ultimate
timeout closer to the 1-second value that AMI use in their Linux driver, and mark the mailbox structures as volatile so that gcc doesn't over-optimise access to them. This should fix the "controller wedged" bug. Submitted by: Brian Dean <brdean@unx.sas.com>
Diffstat (limited to 'sys/dev/amr')
-rw-r--r--sys/dev/amr/amr.c9
-rw-r--r--sys/dev/amr/amrvar.h4
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index 6d7524d..3145e08 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -1126,7 +1126,7 @@ amr_start(struct amr_command *ac)
/* spin waiting for the mailbox */
debug("wait for mailbox");
- for (i = 100000, done = 0, worked = 0; (i > 0) && !done; i--) {
+ for (i = 10000, done = 0, worked = 0; (i > 0) && !done; i--) {
s = splbio();
/* is the mailbox free? */
@@ -1142,7 +1142,12 @@ amr_start(struct amr_command *ac)
/* not free, try to clean up while we wait */
} else {
debug("busy flag %x\n", sc->amr_mailbox->mb_busy);
- worked = amr_done(sc);
+ /* try to kill some time being useful */
+ if (amr_done(sc)) {
+ worked = 1;
+ } else {
+ DELAY(100);
+ }
}
splx(s);
}
diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h
index f3955a6..13e0f46 100644
--- a/sys/dev/amr/amrvar.h
+++ b/sys/dev/amr/amrvar.h
@@ -106,8 +106,8 @@ struct amr_softc
void *amr_intr;
/* mailbox */
- struct amr_mailbox *amr_mailbox;
- struct amr_mailbox64 *amr_mailbox64;
+ volatile struct amr_mailbox *amr_mailbox;
+ volatile struct amr_mailbox64 *amr_mailbox64;
u_int32_t amr_mailboxphys;
bus_dma_tag_t amr_mailbox_dmat;
bus_dmamap_t amr_mailbox_dmamap;
OpenPOWER on IntegriCloud