From d163d5b8c858e139e8cb436d62dfbd24ae3023cd Mon Sep 17 00:00:00 2001 From: Eric Moore Date: Thu, 9 Jan 2003 21:02:28 +0000 Subject: [PATCH] Fix for DELL PERC firmware. Driver was hanging during load time; this attributed to the mailbox busy byte not being set prior to issuing a polling command. Approved by: ps MFC: 7 days --- sys/dev/amr/amr.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index a95e78ba707e..e75c2afc1429 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -977,7 +977,7 @@ amr_quartz_poll_command(struct amr_command *ac) { struct amr_softc *sc = ac->ac_sc; int s; - int error; + int error,count; debug_called(2); @@ -986,8 +986,16 @@ amr_quartz_poll_command(struct amr_command *ac) s = splbio(); + count=0; + while (sc->amr_busyslots){ + tsleep(sc, PRIBIO | PCATCH, "amrpoll", hz); + if(count++>10) { + break; + } + } + if(sc->amr_busyslots) { - device_printf(sc->amr_dev, "adapter is busy"); + device_printf(sc->amr_dev, "adapter is busy\n"); splx(s); amr_unmapcmd(ac); ac->ac_status=0; @@ -1002,6 +1010,7 @@ amr_quartz_poll_command(struct amr_command *ac) sc->amr_mailbox->mb_status = 0xFF; sc->amr_mailbox->mb_poll = 0; sc->amr_mailbox->mb_ack = 0; + sc->amr_mailbox->mb_busy = 1; AMR_QPUT_IDB(sc, sc->amr_mailboxphys | AMR_QIDB_SUBMIT); @@ -1015,6 +1024,7 @@ amr_quartz_poll_command(struct amr_command *ac) /* acknowledge that we have the commands */ AMR_QPUT_IDB(sc, sc->amr_mailboxphys | AMR_QIDB_ACK); + while(AMR_QGET_IDB(sc) & AMR_QIDB_ACK); splx(s); @@ -1403,6 +1413,10 @@ amr_complete(void *context, int pending) } else if (ac->ac_flags & AMR_CMD_SLEEP) { wakeup(ac); } + + if(!sc->amr_busyslots) { + wakeup(sc); + } } }