Add isa_dma{freeze,thaw}(), used to temporarily stop and then restart
all ISA DMA. Needed by e.g. the SmartCard reader for Sharks.
This commit is contained in:
parent
4c80d03830
commit
680a3d77f4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isa_machdep.h,v 1.7 1998/06/09 00:06:54 thorpej Exp $ */
|
||||
/* $NetBSD: isa_machdep.h,v 1.8 1998/06/09 01:06:33 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -78,6 +78,10 @@ struct alpha_isa_chipset {
|
|||
_isa_dmafinished(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmadone(ic, c) \
|
||||
_isa_dmadone(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmafreeze(ic) \
|
||||
_isa_dmafreeze(&(ic)->ic_dmastate)
|
||||
#define isa_dmathaw(ic) \
|
||||
_isa_dmathaw(&(ic)->ic_dmastate)
|
||||
#define isa_dmamem_alloc(ic, c, s, ap, f) \
|
||||
_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
|
||||
#define isa_dmamem_free(ic, c, a, s) \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isa_machdep.h,v 1.3 1998/06/09 00:08:43 thorpej Exp $ */
|
||||
/* $NetBSD: isa_machdep.h,v 1.4 1998/06/09 01:06:33 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -117,6 +117,10 @@ void isa_intr_disestablish __P((isa_chipset_tag_t ic, void *handler));
|
|||
_isa_dmafinished(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmadone(ic, c) \
|
||||
_isa_dmadone(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmafreeze(ic) \
|
||||
_isa_dmafreeze(&(ic)->ic_dmastate)
|
||||
#define isa_dmathaw(ic) \
|
||||
_isa_dmathaw(&(ic)->ic_dmastate)
|
||||
#define isa_dmamem_alloc(ic, c, s, ap, f) \
|
||||
_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
|
||||
#define isa_dmamem_free(ic, c, a, s) \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isa_machdep.h,v 1.5 1998/06/09 00:10:02 thorpej Exp $ */
|
||||
/* $NetBSD: isa_machdep.h,v 1.6 1998/06/09 01:06:33 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -133,6 +133,10 @@ void isa_intr_disestablish __P((isa_chipset_tag_t ic, void *handler));
|
|||
_isa_dmafinished(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmadone(ic, c) \
|
||||
_isa_dmadone(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmafreeze(ic) \
|
||||
_isa_dmafreeze(&(ic)->ic_dmastate)
|
||||
#define isa_dmathaw(ic) \
|
||||
_isa_dmathaw(&(ic)->ic_dmastate)
|
||||
#define isa_dmamem_alloc(ic, c, s, ap, f) \
|
||||
_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
|
||||
#define isa_dmamem_free(ic, c, a, s) \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isa_machdep.h,v 1.10 1998/06/09 00:12:18 thorpej Exp $ */
|
||||
/* $NetBSD: isa_machdep.h,v 1.11 1998/06/09 01:06:34 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -137,6 +137,10 @@ void isa_mem_free __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
|
|||
_isa_dmafinished(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmadone(ic, c) \
|
||||
_isa_dmadone(&(ic)->ic_dmastate, (c))
|
||||
#define isa_dmafreeze(ic) \
|
||||
_isa_dmafreeze(&(ic)->ic_dmastate)
|
||||
#define isa_dmathaw(ic) \
|
||||
_isa_dmathaw(&(ic)->ic_dmastate)
|
||||
#define isa_dmamem_alloc(ic, c, s, ap, f) \
|
||||
_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
|
||||
#define isa_dmamem_free(ic, c, a, s) \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isadma.c,v 1.34 1998/06/09 00:00:21 thorpej Exp $ */
|
||||
/* $NetBSD: isadma.c,v 1.35 1998/06/09 01:04:18 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -84,6 +84,15 @@ _isa_dmaunmask(ids, chan)
|
|||
{
|
||||
int ochan = chan & 3;
|
||||
|
||||
ISA_DMA_MASK_CLR(ids, chan);
|
||||
|
||||
/*
|
||||
* If DMA is frozen, don't unmask it now. It will be
|
||||
* unmasked when DMA is thawed again.
|
||||
*/
|
||||
if (ids->ids_frozen)
|
||||
return;
|
||||
|
||||
/* set dma channel mode, and set dma channel mode */
|
||||
if ((chan & 4) == 0)
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma1h,
|
||||
|
@ -100,6 +109,14 @@ _isa_dmamask(ids, chan)
|
|||
{
|
||||
int ochan = chan & 3;
|
||||
|
||||
ISA_DMA_MASK_SET(ids, chan);
|
||||
|
||||
/*
|
||||
* XXX Should we avoid masking the channel if DMA is
|
||||
* XXX frozen? It seems like what we're doing should
|
||||
* XXX be safe, and we do need to reset FFC...
|
||||
*/
|
||||
|
||||
/* set dma channel mode, and set dma channel mode */
|
||||
if ((chan & 4) == 0) {
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma1h,
|
||||
|
@ -157,6 +174,11 @@ _isa_dmainit(ids, bst, dmat, dev)
|
|||
&ids->ids_dmapgh))
|
||||
panic("_isa_dmainit: unable to map DMA page registers");
|
||||
|
||||
/*
|
||||
* All 8 DMA channels start out "masked".
|
||||
*/
|
||||
ids->ids_masked = 0xff;
|
||||
|
||||
ids->ids_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
@ -507,6 +529,50 @@ _isa_dmadone(ids, chan)
|
|||
ids->ids_dmareads &= ~(1 << chan);
|
||||
}
|
||||
|
||||
void
|
||||
_isa_dmafreeze(ids)
|
||||
struct isa_dma_state *ids;
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
if (ids->ids_frozen == 0) {
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma1h,
|
||||
DMA1_MASK, 0x0f);
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma2h,
|
||||
DMA2_MASK, 0x0f);
|
||||
}
|
||||
|
||||
ids->ids_frozen++;
|
||||
if (ids->ids_frozen < 1)
|
||||
panic("_isa_dmafreeze: overflow");
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
_isa_dmathaw(ids)
|
||||
struct isa_dma_state *ids;
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
ids->ids_frozen--;
|
||||
if (ids->ids_frozen < 0)
|
||||
panic("_isa_dmathaw: underflow");
|
||||
|
||||
if (ids->ids_frozen == 0) {
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma1h,
|
||||
DMA1_MASK, ids->ids_masked & 0x0f);
|
||||
bus_space_write_1(ids->ids_bst, ids->ids_dma2h,
|
||||
DMA2_MASK, (ids->ids_masked >> 4) & 0x0f);
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
_isa_dmamem_alloc(ids, chan, size, addrp, flags)
|
||||
struct isa_dma_state *ids;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isadmavar.h,v 1.11 1998/06/09 00:00:21 thorpej Exp $ */
|
||||
/* $NetBSD: isadmavar.h,v 1.12 1998/06/09 01:04:17 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -63,6 +63,8 @@ struct isa_dma_state {
|
|||
int ids_drqmap; /* available DRQs (bitmap) */
|
||||
int ids_dmareads; /* state for isa_dmadone() (bitmap) */
|
||||
int ids_dmafinished; /* DMA completion state (bitmap) */
|
||||
int ids_masked; /* masked channels (bitmap) */
|
||||
int ids_frozen; /* `frozen' count */
|
||||
int ids_initialized; /* only initialize once... */
|
||||
};
|
||||
|
||||
|
@ -75,6 +77,12 @@ struct isa_dma_state {
|
|||
#define ISA_DMA_DRQ_FREE(state, drq) \
|
||||
(state)->ids_drqmap &= ~(1 << (drq))
|
||||
|
||||
#define ISA_DMA_MASK_SET(state, drq) \
|
||||
(state)->ids_masked |= (1 << (drq))
|
||||
|
||||
#define ISA_DMA_MASK_CLR(state, drq) \
|
||||
(state)->ids_masked &= ~(1 << (drq))
|
||||
|
||||
/*
|
||||
* Memory list used by _isa_malloc().
|
||||
*/
|
||||
|
@ -106,6 +114,9 @@ bus_size_t _isa_dmacount __P((struct isa_dma_state *, int));
|
|||
int _isa_dmafinished __P((struct isa_dma_state *, int));
|
||||
void _isa_dmadone __P((struct isa_dma_state *, int));
|
||||
|
||||
void _isa_dmafreeze __P((struct isa_dma_state *));
|
||||
void _isa_dmathaw __P((struct isa_dma_state *));
|
||||
|
||||
int _isa_dmamem_alloc __P((struct isa_dma_state *, int, bus_size_t,
|
||||
bus_addr_t *, int));
|
||||
void _isa_dmamem_free __P((struct isa_dma_state *, int, bus_addr_t,
|
||||
|
|
Loading…
Reference in New Issue