Set the sc_ixfer function pointer to the default sfas_ixfer() function

during initialisation if the pointer is NULL.
Use the sc_ixfer function pointer in the sfas softc when doing
immediate polled transfers.
This commit is contained in:
mark 1997-02-04 06:57:47 +00:00
parent 1715a217cf
commit 06f80904ec
1 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfas.c,v 1.9 1997/01/18 01:38:07 mark Exp $ */ /* $NetBSD: sfas.c,v 1.10 1997/02/04 06:57:47 mark Exp $ */
/* /*
* Copyright (c) 1995 Scott Stevens * Copyright (c) 1995 Scott Stevens
@ -79,6 +79,7 @@ void sfas_scsidone __P((struct sfas_softc *dev, struct scsi_xfer *xs,
int stat)); int stat));
void sfasintr __P((struct sfas_softc *dev)); void sfasintr __P((struct sfas_softc *dev));
void sfasiwait __P((struct sfas_softc *dev)); void sfasiwait __P((struct sfas_softc *dev));
void sfas_ixfer __P((struct sfas_softc *dev, int polling));
void sfasreset __P((struct sfas_softc *dev, int how)); void sfasreset __P((struct sfas_softc *dev, int how));
int sfasselect __P((struct sfas_softc *dev, struct sfas_pending *pendp, int sfasselect __P((struct sfas_softc *dev, struct sfas_pending *pendp,
unsigned char *cbuf, int clen, unsigned char *cbuf, int clen,
@ -188,6 +189,9 @@ sfasinitialize(dev)
for(i=0; i<8; i++) for(i=0; i<8; i++)
sfas_init_nexus(dev, &dev->sc_nexus[i]); sfas_init_nexus(dev, &dev->sc_nexus[i]);
if (dev->sc_ixfer == NULL)
dev->sc_ixfer = sfas_ixfer;
/* /*
* Setup bump buffer. * Setup bump buffer.
*/ */
@ -200,7 +204,8 @@ sfasinitialize(dev)
*/ */
pte = pmap_pte(kernel_pmap, (vm_offset_t)dev->sc_bump_va); pte = pmap_pte(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
*pte &= ~(PT_C | PT_B); *pte &= ~(PT_C | PT_B);
tlb_flush(); /* XXX - should be a purge */ cpu_tlb_flushD();
cpu_cache_purgeD_rng((vm_offset_t)dev->sc_bump_va, NBPG);
printf(" dmabuf V0x%08x P0x%08x", (u_int)dev->sc_bump_va, (u_int)dev->sc_bump_pa); printf(" dmabuf V0x%08x P0x%08x", (u_int)dev->sc_bump_va, (u_int)dev->sc_bump_pa);
} }
@ -790,12 +795,10 @@ sfas_setup_nexus(dev, nexus, pendp, cbuf, clen, buf, len, mode)
buf, len); buf, len);
} }
/* Flush the caches. (If needed) */ /* Flush the caches. */
/* Do I need to ? */
/* if (len && !(mode & SFAS_SELECT_I))
if ((mmutype == MMU_68040) && len && !(mode & SFAS_SELECT_I)) cpu_cache_purgeD_rng((vm_offset_t)buf, len);
dma_cachectl(buf, len);
*/
} }
int int
@ -1277,7 +1280,7 @@ sfas_postaction(dev, rp, nexus)
/* We should use polled IO here. */ /* We should use polled IO here. */
if (dev->sc_dma_blk_flg == SFAS_CHAIN_PRG) { if (dev->sc_dma_blk_flg == SFAS_CHAIN_PRG) {
sfas_ixfer(dev, nexus->xs->flags & SCSI_POLL); dev->sc_ixfer(dev, nexus->xs->flags & SCSI_POLL);
dev->sc_cur_link++; dev->sc_cur_link++;
dev->sc_dma_len = 0; dev->sc_dma_len = 0;
break; break;
@ -1308,7 +1311,7 @@ sfas_postaction(dev, rp, nexus)
((nexus->state == SFAS_NS_DATA_OUT) ? ((nexus->state == SFAS_NS_DATA_OUT) ?
SFAS_DMA_WRITE : SFAS_DMA_READ)); SFAS_DMA_WRITE : SFAS_DMA_READ));
printf("Using DMA !!!!\n"); /* printf("Using DMA !!!!\n");*/
cmd = SFAS_CMD_TRANSFER_INFO | SFAS_CMD_DMA; cmd = SFAS_CMD_TRANSFER_INFO | SFAS_CMD_DMA;
} else { } else {
/* /*
@ -1697,4 +1700,3 @@ dump_sfassoftc(sc)
} }
#endif /* SFAS_DEBUG */ #endif /* SFAS_DEBUG */