diff options
-rw-r--r-- | sys/dev/ic/siop.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index 82d2c13db9b..aa8f81b00ea 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siop.c,v 1.38 2005/03/12 17:36:25 martin Exp $ */ +/* $OpenBSD: siop.c,v 1.39 2005/10/08 19:48:42 krw Exp $ */ /* $NetBSD: siop.c,v 1.65 2002/11/08 22:04:41 bouyer Exp $ */ /* @@ -21,7 +21,7 @@ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY @@ -122,7 +122,7 @@ static int siop_stat_intr_qfull = 0; void siop_printstats(void); #define INCSTAT(x) x++ #else -#define INCSTAT(x) +#define INCSTAT(x) #endif void @@ -368,6 +368,7 @@ siop_intr(v) SIOP_ISTAT, 0); } /* use DSA to find the current siop_cmd */ + siop_cmd = NULL; dsa = bus_space_read_4(sc->sc_c.sc_rt, sc->sc_c.sc_rh, SIOP_DSA); TAILQ_FOREACH(cbdp, &sc->cmds, next) { if (dsa >= cbdp->xferdma->dm_segs[0].ds_addr && @@ -378,9 +379,6 @@ siop_intr(v) BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); break; } - } - if (cbdp == NULL) { - siop_cmd = NULL; } if (siop_cmd) { xs = siop_cmd->cmd_c.xs; @@ -451,7 +449,7 @@ siop_intr(v) if (dstat & DSTAT_MDPE) printf(" parity"); if (dstat & DSTAT_DFE) - printf(" dma fifo empty"); + printf(" DMA fifo empty"); else siop_clearfifo(&sc->sc_c); printf(", DSP=0x%x DSA=0x%x: ", @@ -462,7 +460,7 @@ siop_intr(v) printf("last msg_in=0x%x status=0x%x\n", siop_cmd->cmd_tables->msg_in[0], letoh32(siop_cmd->cmd_tables->status)); - else + else printf("current DSA invalid\n"); need_reset = 1; } @@ -501,7 +499,7 @@ siop_intr(v) goto reset; } if ((sist & SIST0_MA) && need_reset == 0) { - if (siop_cmd) { + if (siop_cmd) { int scratcha0; /* XXX Why read DSTAT again? */ dstat = bus_space_read_1(sc->sc_c.sc_rt, @@ -678,7 +676,7 @@ scintr: printf("%s: reselect with invalid target\n", sc->sc_c.sc_dev.dv_xname); goto reset; - case A_int_resellun: + case A_int_resellun: INCSTAT(siop_stat_intr_lunresel); target = bus_space_read_1(sc->sc_c.sc_rt, sc->sc_c.sc_rh, SIOP_SCRATCHA) & 0xf; @@ -793,7 +791,7 @@ scintr: siop_target->target_c.flags &= ~(TARF_DT | TARF_ISDT); CALL_SCRIPT(Ent_msgin_ack); return 1; - } else if (msg == MSG_SIMPLE_Q_TAG || + } else if (msg == MSG_SIMPLE_Q_TAG || msg == MSG_HEAD_OF_Q_TAG || msg == MSG_ORDERED_Q_TAG) { if (siop_handle_qtag_reject( @@ -834,7 +832,7 @@ scintr: case A_int_extmsgin: #ifdef SIOP_DEBUG_INTR printf("extended message: msg 0x%x len %d\n", - siop_cmd->cmd_tables->msg_in[2], + siop_cmd->cmd_tables->msg_in[2], siop_cmd->cmd_tables->msg_in[1]); #endif if (siop_cmd->cmd_tables->msg_in[1] > @@ -1224,7 +1222,7 @@ siop_handle_reset(sc) if (sc->sc_c.targets[target] == NULL) continue; for (lun = 0; lun < 8; lun++) { - struct siop_target *siop_target = + struct siop_target *siop_target = (struct siop_target *)sc->sc_c.targets[target]; siop_lun = siop_target->siop_lun[lun]; if (siop_lun == NULL) @@ -1495,7 +1493,7 @@ siop_start(sc) /* * The queue management here is a bit tricky: the script always looks - * at the slot from first to last, so if we always use the first + * at the slot from first to last, so if we always use the first * free slot commands can stay at the tail of the queue ~forever. * The algorithm used here is to restart from the head when we know * that the queue is empty, and only add commands after the last one. @@ -1626,7 +1624,7 @@ again: Ent_ldsa_reload_dsa); /* CMD script: MOVE MEMORY addr */ siop_xfer = (struct siop_xfer*)siop_cmd->cmd_tables; - siop_xfer->resel[E_ldsa_abs_slot_Used[0]] = + siop_xfer->resel[E_ldsa_abs_slot_Used[0]] = htole32(sc->sc_c.sc_scriptaddr + Ent_script_sched_slot0 + slot * 8); siop_table_sync(siop_cmd, BUS_DMASYNC_PREWRITE); /* scheduler slot: JUMP ldsa_select */ @@ -1913,7 +1911,7 @@ siop_get_lunsw(sc) sc->sc_c.sc_script[sc->script_free_lo + i] = htole32(lun_switch[i]); sc->sc_c.sc_script[ - sc->script_free_lo + E_abs_lunsw_return_Used[0]] = + sc->script_free_lo + E_abs_lunsw_return_Used[0]] = htole32(sc->sc_c.sc_scriptaddr + Ent_lunsw_return); } lunsw->lunsw_off = sc->script_free_lo; @@ -2068,11 +2066,11 @@ siop_add_dev(sc, target, lun) for(i = 0; i < sizeof(tag_switch) / sizeof(tag_switch[0]); i++) { - sc->sc_c.sc_script[sc->script_free_hi + i] = + sc->sc_c.sc_script[sc->script_free_hi + i] = htole32(tag_switch[i]); } } - siop_script_write(sc, + siop_script_write(sc, siop_lun->reseloff + 1, sc->sc_c.sc_scriptaddr + sc->script_free_hi * 4 + Ent_tag_switch_entry); @@ -2083,7 +2081,7 @@ siop_add_dev(sc, target, lun) } } else { /* non-tag case; just work with the lun switch */ - siop_lun->siop_tag[0].reseloff = + siop_lun->siop_tag[0].reseloff = siop_target->siop_lun[lun]->reseloff; } siop_script_sync(sc, BUS_DMASYNC_PREWRITE); |