- register struct ikdevice *ik;
- register struct buf *bp, *dp;
- struct ik_softc *sc;
- register u_short data;
- u_short i, v;
-
- /* should go by controller, but for now... */
- if (ikinfo[ikon] == 0)
- return;
- ik = (struct ikdevice *)ikinfo[ikon]->ui_addr;
- /*
- * Discard all non-attention interrupts. The
- * interrupts we're throwing away should all be
- * associated with DMA completion.
- */
- data = ik->ik_data;
- if ((ik->ik_csr&(IKCSR_ATTF|IKCSR_STATC)) != IKCSR_ATTF) {
- ik->ik_pulse = IKPULSE_RATTF|IKPULSE_RDMAF|IKPULSE_SIENA;
- return;
- }
- /*
- * Fetch attention code immediately.
- */
- ik->ik_csr = IKCSR_RATTF|IKCSR_RDMAF|IKCSR_FNC1;
- ik->ik_pulse = IKPULSE_FNC2;
- /*
- * Get device and block structures, and a pointer
- * to the vba_device for the device. We receive an
- * unsolicited interrupt whenever the PS300 is power
- * cycled (so ignore it in that case).
- */
- dp = &iktab[ikon];
- if ((bp = dp->b_actf) == NULL) {
- if (PS_CODE(data) != PS_RESET) /* power failure */
- log(LOG_WARNING, "ik%d: spurious interrupt, code %x\n",
- ikon, data);
- goto enable;
- }
- sc = &ik_softc[IKUNIT(bp->b_dev)];
- sc->is_timeout = 0; /* disable timer */
- switch (PS_CODE(data)) {
-
- case PS_LOOKUP: /* name lookup */
- if (data == PS_LOOKUP) { /* dma name */
- bp->b_command = PS_DMAOUT;
- goto opcont;
- }
- if (data == PS_DMAOK(PS_LOOKUP)) {
- /* reenable interrupt and wait for address */
- sc->is_timeout = iktimeout;
- goto enable;
- }
- /*
- * Address should be present, extract it one
- * word at a time from the PS300 (yech).
- */
- if (data != PS_ADROK(PS_LOOKUP))
- goto bad;
- FETCHWORD(0);
- FETCHWORD(1);
- goto opdone;
-
- case PS_WRPHY_SYNC: /* physical i/o write w/ sync */
- if (data == PS_WRPHY_SYNC) { /* start dma transfer */
- bp->b_command = PS_DMAOUT;
- goto opcont;
- }
- if (data != PS_DMAOK(PS_WRPHY_SYNC))
- goto bad;
- goto opdone;
-
- case PS_WRPHY: /* physical i/o write */
- if (data == PS_WRPHY) { /* start dma transfer */
- bp->b_command = PS_DMAOUT;
- goto opcont;
- }
- if (data != PS_DMAOK(PS_WRPHY))
- goto bad;
- goto opdone;
-
- case PS_ATTACH: /* attach unit */
- case PS_DETACH: /* detach unit */
- case PS_ABORT: /* abort code from ps300 */
- if (data != bp->b_command)
- goto bad;
- goto opdone;
-
- case PS_RDPHY: /* physical i/o read */
- if (data == PS_RDPHY) { /* dma address list */
- bp->b_command = PS_DMAOUT;
- goto opcont;
- }
- if (data == PS_ADROK(PS_RDPHY)) {
- /* collect read byte count and start dma */
- bp->b_bcount = dioread(ik);
- if (bp->b_bcount == -1)
- goto bad;
- bp->b_command = PS_DMAIN;
- goto opcont;
- }
- if (data == PS_DMAOK(PS_RDPHY))
- goto opdone;
- goto bad;
- }
+ register struct ikdevice *ik;
+ register struct buf *bp, *dp;
+ struct ik_softc *sc;
+ register u_short data;
+ u_short i, v;
+
+ /* should go by controller, but for now... */
+ if (ikinfo[ikon] == 0)
+ return;
+ ik = (struct ikdevice *)ikinfo[ikon]->ui_addr;
+ /*
+ * Discard all non-attention interrupts. The
+ * interrupts we're throwing away should all be
+ * associated with DMA completion.
+ */
+ data = ik->ik_data;
+ if ((ik->ik_csr&(IKCSR_ATTF|IKCSR_STATC)) != IKCSR_ATTF) {
+ ik->ik_pulse = IKPULSE_RATTF|IKPULSE_RDMAF|IKPULSE_SIENA;
+ return;
+ }
+ /*
+ * Fetch attention code immediately.
+ */
+ ik->ik_csr = IKCSR_RATTF|IKCSR_RDMAF|IKCSR_FNC1;
+ ik->ik_pulse = IKPULSE_FNC2;
+ /*
+ * Get device and block structures, and a pointer
+ * to the vba_device for the device. We receive an
+ * unsolicited interrupt whenever the PS300 is power
+ * cycled (so ignore it in that case).
+ */
+ dp = &iktab[ikon];
+ if ((bp = dp->b_actf) == NULL) {
+ if (PS_CODE(data) != PS_RESET) /* power failure */
+ log(LOG_WARNING, "ik%d: spurious interrupt, code %x\n",
+ ikon, data);
+ goto enable;
+ }
+ sc = &ik_softc[IKUNIT(bp->b_dev)];
+ sc->is_timeout = 0; /* disable timer */
+ switch (PS_CODE(data)) {
+
+ case PS_LOOKUP: /* name lookup */
+ if (data == PS_LOOKUP) { /* dma name */
+ bp->b_command = PS_DMAOUT;
+ goto opcont;
+ }
+ if (data == PS_DMAOK(PS_LOOKUP)) {
+ /* reenable interrupt and wait for address */
+ sc->is_timeout = iktimeout;
+ goto enable;
+ }
+ /*
+ * Address should be present, extract it one
+ * word at a time from the PS300 (yech).
+ */
+ if (data != PS_ADROK(PS_LOOKUP))
+ goto bad;
+ FETCHWORD(0);
+ FETCHWORD(1);
+ goto opdone;
+
+ case PS_WRPHY_SYNC: /* physical i/o write w/ sync */
+ if (data == PS_WRPHY_SYNC) { /* start dma transfer */
+ bp->b_command = PS_DMAOUT;
+ goto opcont;
+ }
+ if (data != PS_DMAOK(PS_WRPHY_SYNC))
+ goto bad;
+ goto opdone;
+
+ case PS_WRPHY: /* physical i/o write */
+ if (data == PS_WRPHY) { /* start dma transfer */
+ bp->b_command = PS_DMAOUT;
+ goto opcont;
+ }
+ if (data != PS_DMAOK(PS_WRPHY))
+ goto bad;
+ goto opdone;
+
+ case PS_ATTACH: /* attach unit */
+ case PS_DETACH: /* detach unit */
+ case PS_ABORT: /* abort code from ps300 */
+ if (data != bp->b_command)
+ goto bad;
+ goto opdone;
+
+ case PS_RDPHY: /* physical i/o read */
+ if (data == PS_RDPHY) { /* dma address list */
+ bp->b_command = PS_DMAOUT;
+ goto opcont;
+ }
+ if (data == PS_ADROK(PS_RDPHY)) {
+ /* collect read byte count and start dma */
+ bp->b_bcount = dioread(ik);
+ if (bp->b_bcount == -1)
+ goto bad;
+ bp->b_command = PS_DMAIN;
+ goto opcont;
+ }
+ if (data == PS_DMAOK(PS_RDPHY))
+ goto opdone;
+ goto bad;
+ }