From 59cd090d9b4c5b59a23d55192d5bc5511f426f8a Mon Sep 17 00:00:00 2001 From: niklas Date: Wed, 31 Jan 1996 22:54:50 +0000 Subject: [PATCH] from netbsd: fix loading of 0 to intended value of 256, plus style police --- sys/arch/amiga/dev/sfas.c | 87 ++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/sys/arch/amiga/dev/sfas.c b/sys/arch/amiga/dev/sfas.c index 2c89c1ea828..5e9eedaafba 100644 --- a/sys/arch/amiga/dev/sfas.c +++ b/sys/arch/amiga/dev/sfas.c @@ -1404,54 +1404,57 @@ sfas_postaction(dev, rp, nexus) * from the DMA block. */ dev->sc_setup_dma(dev, 0, 0, SFAS_DMA_CLEAR); if (dev->sc_cur_link < dev->sc_max_link) { - if (!dev->sc_dma_blk_len) { - dev->sc_dma_blk_ptr = dev->sc_chain[dev->sc_cur_link].ptr; - dev->sc_dma_blk_len = dev->sc_chain[dev->sc_cur_link].len; - dev->sc_dma_blk_flg = dev->sc_chain[dev->sc_cur_link].flg; - } - - /* We should use polled IO here. */ - if (dev->sc_dma_blk_flg == SFAS_CHAIN_PRG) { - sfas_ixfer(dev); - dev->sc_cur_link++; - dev->sc_dma_len = 0; - break; - } - else if (dev->sc_dma_blk_flg == SFAS_CHAIN_BUMP) - len = dev->sc_dma_blk_len; - else - len = dev->sc_need_bump(dev, dev->sc_dma_blk_ptr, - dev->sc_dma_blk_len); - - /* - * If len != 0 we must bump the data, else we just DMA it - * straight into memory. - */ - if (len) { - dev->sc_dma_buf = dev->sc_bump_pa; - dev->sc_dma_len = len; - - if (nexus->state == SFAS_NS_DATA_OUT) - bcopy(dev->sc_buf, dev->sc_bump_va, dev->sc_dma_len); - } else { - dev->sc_dma_buf = dev->sc_dma_blk_ptr; - dev->sc_dma_len = dev->sc_dma_blk_len; - } - - /* Load DMA with adress and length of transfer. */ - dev->sc_setup_dma(dev, dev->sc_dma_buf, dev->sc_dma_len, - ((nexus->state == SFAS_NS_DATA_OUT) ? - SFAS_DMA_WRITE : SFAS_DMA_READ)); - - cmd = SFAS_CMD_TRANSFER_INFO | SFAS_CMD_DMA; + if (!dev->sc_dma_blk_len) { + dev->sc_dma_blk_ptr = + dev->sc_chain[dev->sc_cur_link].ptr; + dev->sc_dma_blk_len = + dev->sc_chain[dev->sc_cur_link].len; + dev->sc_dma_blk_flg = + dev->sc_chain[dev->sc_cur_link].flg; + } + + /* We should use polled IO here. */ + if (dev->sc_dma_blk_flg == SFAS_CHAIN_PRG) { + sfas_ixfer(dev); + dev->sc_cur_link++; + dev->sc_dma_len = 0; + break; + } else if (dev->sc_dma_blk_flg == SFAS_CHAIN_BUMP) + len = dev->sc_dma_blk_len; + else + len = dev->sc_need_bump(dev, + dev->sc_dma_blk_ptr, dev->sc_dma_blk_len); + + /* + * If len != 0 we must bump the data, else we just + * DMA it straight into memory. + */ + if (len) { + dev->sc_dma_buf = dev->sc_bump_pa; + dev->sc_dma_len = len; + + if (nexus->state == SFAS_NS_DATA_OUT) + bcopy(dev->sc_buf, dev->sc_bump_va, + dev->sc_dma_len); + } else { + dev->sc_dma_buf = dev->sc_dma_blk_ptr; + dev->sc_dma_len = dev->sc_dma_blk_len; + } + + /* Load DMA with adress and length of transfer. */ + dev->sc_setup_dma(dev, dev->sc_dma_buf, dev->sc_dma_len, + ((nexus->state == SFAS_NS_DATA_OUT) + ? SFAS_DMA_WRITE : SFAS_DMA_READ)); + + cmd = SFAS_CMD_TRANSFER_INFO | SFAS_CMD_DMA; } else { /* * Hmmm, the unit wants more info than we have or has * more than we want. Let the chip handle that. */ - *rp->sfas_tc_low = 256; - *rp->sfas_tc_mid = 0; + *rp->sfas_tc_low = 0; + *rp->sfas_tc_mid = 1; *rp->sfas_tc_high = 0; cmd = SFAS_CMD_TRANSFER_PAD; } -- 2.20.1