Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
This commit is contained in:
parent
405e360fa4
commit
3366b987d0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sgmap_common.c,v 1.4 1998/01/17 03:37:22 thorpej Exp $ */
|
||||
/* $NetBSD: sgmap_common.c,v 1.5 1998/01/17 21:53:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.4 1998/01/17 03:37:22 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.5 1998/01/17 21:53:52 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -120,41 +120,40 @@ alpha_sgmap_alloc(map, len, sgmap, flags)
|
||||
struct alpha_sgmap *sgmap;
|
||||
int flags;
|
||||
{
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
int error;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
panic("alpha_sgmap_alloc: already have sgva space");
|
||||
#endif
|
||||
|
||||
a->apdc_len = round_page(len);
|
||||
error = extent_alloc(sgmap->aps_ex, a->apdc_len, NBPG,
|
||||
map->_dm_sgvalen = round_page(len);
|
||||
error = extent_alloc(sgmap->aps_ex, map->_dm_sgvalen, NBPG,
|
||||
map->_dm_boundary, (flags & BUS_DMA_NOWAIT) ? EX_NOWAIT :
|
||||
EX_WAITOK, &a->apdc_sgva);
|
||||
EX_WAITOK, &map->_dm_sgva);
|
||||
|
||||
if (error == 0)
|
||||
a->apdc_flags |= APDC_HAS_SGMAP;
|
||||
map->_dm_flags |= DMAMAP_HAS_SGMAP;
|
||||
else
|
||||
a->apdc_flags &= ~APDC_HAS_SGMAP;
|
||||
map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
alpha_sgmap_free(sgmap, a)
|
||||
alpha_sgmap_free(map, sgmap)
|
||||
bus_dmamap_t map;
|
||||
struct alpha_sgmap *sgmap;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
{
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((a->apdc_flags & APDC_HAS_SGMAP) == 0)
|
||||
if ((map->_dm_flags & DMAMAP_HAS_SGMAP) == 0)
|
||||
panic("alpha_sgmap_free: no sgva space to free");
|
||||
#endif
|
||||
|
||||
if (extent_free(sgmap->aps_ex, a->apdc_sgva,
|
||||
a->apdc_len, EX_NOWAIT))
|
||||
if (extent_free(sgmap->aps_ex, map->_dm_sgva, map->_dm_sgvalen,
|
||||
EX_NOWAIT))
|
||||
panic("alpha_sgmap_free");
|
||||
|
||||
a->apdc_flags &= ~APDC_HAS_SGMAP;
|
||||
map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sgmap_typedep.c,v 1.5 1998/01/17 03:38:51 thorpej Exp $ */
|
||||
/* $NetBSD: sgmap_typedep.c,v 1.6 1998/01/17 21:53:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.5 1998/01/17 03:38:51 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.6 1998/01/17 21:53:52 thorpej Exp $");
|
||||
|
||||
#ifdef SGMAP_LOG
|
||||
|
||||
@ -67,7 +67,6 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
|
||||
int flags;
|
||||
struct alpha_sgmap *sgmap;
|
||||
{
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
vm_offset_t va = (vm_offset_t)buf;
|
||||
vm_offset_t pa, endva;
|
||||
bus_addr_t dmaoffset;
|
||||
@ -117,13 +116,13 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
|
||||
*/
|
||||
endva = round_page(va + buflen);
|
||||
va = trunc_page(va);
|
||||
if ((a->apdc_flags & APDC_HAS_SGMAP) == 0) {
|
||||
if ((map->_dm_flags & DMAMAP_HAS_SGMAP) == 0) {
|
||||
error = alpha_sgmap_alloc(map, endva - va, sgmap, flags);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
|
||||
pteidx = a->apdc_sgva >> PGSHIFT;
|
||||
pteidx = map->_dm_sgva >> PGSHIFT;
|
||||
pte = &page_table[pteidx * SGMAP_PTE_SPACING];
|
||||
|
||||
#ifdef SGMAP_DEBUG
|
||||
@ -142,7 +141,7 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
|
||||
|
||||
#ifdef SGMAP_LOG
|
||||
if (panicstr == NULL) {
|
||||
sl.sl_sgva = a->apdc_sgva;
|
||||
sl.sl_sgva = map->_dm_sgva;
|
||||
sl.sl_dmaaddr = map->dm_segs[0].ds_addr;
|
||||
}
|
||||
#endif
|
||||
@ -155,11 +154,11 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
|
||||
map->dm_segs[0].ds_addr);
|
||||
#endif
|
||||
|
||||
a->apdc_pteidx = pteidx;
|
||||
a->apdc_ptecnt = 0;
|
||||
map->_dm_pteidx = pteidx;
|
||||
map->_dm_ptecnt = 0;
|
||||
|
||||
for (; va < endva; va += NBPG, pte += SGMAP_PTE_SPACING,
|
||||
a->apdc_ptecnt++) {
|
||||
map->_dm_ptecnt++) {
|
||||
/*
|
||||
* Get the physical address for this segment.
|
||||
*/
|
||||
@ -183,7 +182,7 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
|
||||
|
||||
#ifdef SGMAP_LOG
|
||||
if (panicstr == NULL) {
|
||||
sl.sl_ptecnt = a->apdc_ptecnt;
|
||||
sl.sl_ptecnt = map->_dm_ptecnt;
|
||||
bcopy(&sl, &__C(SGMAP_TYPE,_log)[__C(SGMAP_TYPE,_log_next)],
|
||||
sizeof(sl));
|
||||
__C(SGMAP_TYPE,_log_last) = __C(SGMAP_TYPE,_log_next);
|
||||
@ -246,7 +245,6 @@ __C(SGMAP_TYPE,_unload)(t, map, sgmap)
|
||||
bus_dmamap_t map;
|
||||
struct alpha_sgmap *sgmap;
|
||||
{
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
SGMAP_PTE_TYPE *pte, *page_table = sgmap->aps_pt;
|
||||
int ptecnt;
|
||||
#ifdef SGMAP_LOG
|
||||
@ -258,7 +256,7 @@ __C(SGMAP_TYPE,_unload)(t, map, sgmap)
|
||||
bzero(sl, sizeof(*sl));
|
||||
sl->sl_op = 0;
|
||||
sl->sl_sgmap = sgmap;
|
||||
sl->sl_sgva = a->apdc_sgva;
|
||||
sl->sl_sgva = map->_dm_sgva;
|
||||
sl->sl_dmaaddr = map->dm_segs[0].ds_addr;
|
||||
|
||||
__C(SGMAP_TYPE,_log_last) = __C(SGMAP_TYPE,_log_next);
|
||||
@ -271,8 +269,8 @@ __C(SGMAP_TYPE,_unload)(t, map, sgmap)
|
||||
/*
|
||||
* Invalidate the PTEs for the mapping.
|
||||
*/
|
||||
for (ptecnt = a->apdc_ptecnt,
|
||||
pte = &page_table[a->apdc_pteidx * SGMAP_PTE_SPACING];
|
||||
for (ptecnt = map->_dm_ptecnt,
|
||||
pte = &page_table[map->_dm_pteidx * SGMAP_PTE_SPACING];
|
||||
ptecnt != 0; ptecnt--, pte += SGMAP_PTE_SPACING) {
|
||||
#ifdef SGMAP_DEBUG
|
||||
if (__C(SGMAP_TYPE,_debug))
|
||||
@ -287,5 +285,5 @@ __C(SGMAP_TYPE,_unload)(t, map, sgmap)
|
||||
* if necessary.
|
||||
*/
|
||||
if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
|
||||
alpha_sgmap_free(sgmap, a);
|
||||
alpha_sgmap_free(map, sgmap);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sgmap_typedep.h,v 1.2 1997/06/06 23:58:05 thorpej Exp $ */
|
||||
/* $NetBSD: sgmap_typedep.h,v 1.3 1998/01/17 21:53:53 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sgmapvar.h,v 1.4 1998/01/17 03:37:23 thorpej Exp $ */
|
||||
/* $NetBSD: sgmapvar.h,v 1.5 1998/01/17 21:53:54 thorpej Exp $ */
|
||||
|
||||
#define SGMAP_LOG
|
||||
|
||||
@ -60,22 +60,6 @@ struct alpha_sgmap {
|
||||
bus_addr_t aps_wbase; /* base of the dma window */
|
||||
};
|
||||
|
||||
/*
|
||||
* Cookie used to store SGMAP state for a DMA mapping. We
|
||||
* could compute some of this at unload time, but storing it
|
||||
* is convenient.
|
||||
*/
|
||||
struct alpha_sgmap_cookie {
|
||||
int apdc_pteidx; /* PTE index */
|
||||
int apdc_ptecnt; /* PTE count */
|
||||
u_long apdc_sgva; /* allocated sgva */
|
||||
bus_size_t apdc_len; /* sgva size */
|
||||
int apdc_flags;
|
||||
};
|
||||
|
||||
/* apdc_flags */
|
||||
#define APDC_HAS_SGMAP 0x01 /* sgva/len are valid */
|
||||
|
||||
#ifdef SGMAP_LOG
|
||||
/*
|
||||
* Log entry, used for debugging SGMAPs.
|
||||
@ -98,5 +82,4 @@ void alpha_sgmap_init __P((bus_dma_tag_t, struct alpha_sgmap *,
|
||||
|
||||
int alpha_sgmap_alloc __P((bus_dmamap_t, bus_size_t,
|
||||
struct alpha_sgmap *, int));
|
||||
void alpha_sgmap_free __P((struct alpha_sgmap *,
|
||||
struct alpha_sgmap_cookie *));
|
||||
void alpha_sgmap_free __P((bus_dmamap_t, struct alpha_sgmap *));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: bus.h,v 1.15 1997/08/13 02:53:03 cgd Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.16 1998/01/17 21:53:55 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -402,10 +402,14 @@ struct alpha_bus_space {
|
||||
#define BUS_DMA_BUS3 0x40
|
||||
#define BUS_DMA_BUS4 0x80
|
||||
|
||||
/*
|
||||
* Private flags stored in the DMA map.
|
||||
*/
|
||||
#define DMAMAP_HAS_SGMAP 0x80000000 /* sgva/len are valid */
|
||||
|
||||
/* Forwards needed by prototypes below. */
|
||||
struct mbuf;
|
||||
struct uio;
|
||||
struct alpha_sgmap_cookie;
|
||||
|
||||
/*
|
||||
* bus_dmasync_op_t
|
||||
@ -543,8 +547,14 @@ struct alpha_bus_dmamap {
|
||||
bus_size_t _dm_boundary; /* don't cross this */
|
||||
int _dm_flags; /* misc. flags */
|
||||
|
||||
/* SGMAP cookie used for SGMAP-mapped DMA */
|
||||
struct alpha_sgmap_cookie *_dm_sgcookie;
|
||||
/*
|
||||
* This is used only for SGMAP-mapped DMA, but we keep it
|
||||
* here to avoid pointless indirection.
|
||||
*/
|
||||
int _dm_pteidx; /* PTE index */
|
||||
int _dm_ptecnt; /* PTE count */
|
||||
u_long _dm_sgva; /* allocated sgva */
|
||||
bus_size_t _dm_sgvalen; /* svga length */
|
||||
|
||||
/*
|
||||
* PUBLIC MEMBERS: these are used by machine-independent code.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: apecs_dma.c,v 1.4 1998/01/17 03:40:32 thorpej Exp $ */
|
||||
/* $NetBSD: apecs_dma.c,v 1.5 1998/01/17 21:53:56 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: apecs_dma.c,v 1.4 1998/01/17 03:40:32 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apecs_dma.c,v 1.5 1998/01/17 21:53:56 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -245,7 +245,6 @@ apecs_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
bus_dmamap_t *dmamp;
|
||||
{
|
||||
struct apecs_config *acp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
||||
@ -256,15 +255,6 @@ apecs_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
|
||||
map = *dmamp;
|
||||
|
||||
a = malloc(sizeof(struct alpha_sgmap_cookie), M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
if (a == NULL) {
|
||||
_bus_dmamap_destroy(t, map);
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(a, sizeof(struct alpha_sgmap_cookie));
|
||||
map->_dm_sgcookie = a;
|
||||
|
||||
if (flags & BUS_DMA_ALLOCNOW) {
|
||||
error = alpha_sgmap_alloc(map, round_page(size),
|
||||
&acp->ac_sgmap, flags);
|
||||
@ -284,12 +274,10 @@ apecs_bus_dmamap_destroy_sgmap(t, map)
|
||||
bus_dmamap_t map;
|
||||
{
|
||||
struct apecs_config *acp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
alpha_sgmap_free(&acp->ac_sgmap, a);
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
alpha_sgmap_free(map, &acp->ac_sgmap);
|
||||
|
||||
free(a, M_DEVBUF);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: cia_dma.c,v 1.4 1998/01/17 03:43:59 thorpej Exp $ */
|
||||
/* $NetBSD: cia_dma.c,v 1.5 1998/01/17 21:53:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.4 1998/01/17 03:43:59 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.5 1998/01/17 21:53:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -247,7 +247,6 @@ cia_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
bus_dmamap_t *dmamp;
|
||||
{
|
||||
struct cia_config *ccp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
||||
@ -258,15 +257,6 @@ cia_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
|
||||
map = *dmamp;
|
||||
|
||||
a = malloc(sizeof(struct alpha_sgmap_cookie), M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
if (a == NULL) {
|
||||
_bus_dmamap_destroy(t, map);
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(a, sizeof(struct alpha_sgmap_cookie));
|
||||
map->_dm_sgcookie = a;
|
||||
|
||||
if (flags & BUS_DMA_ALLOCNOW) {
|
||||
error = alpha_sgmap_alloc(map, round_page(size),
|
||||
&ccp->cc_sgmap, flags);
|
||||
@ -286,12 +276,10 @@ cia_bus_dmamap_destroy_sgmap(t, map)
|
||||
bus_dmamap_t map;
|
||||
{
|
||||
struct cia_config *ccp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
alpha_sgmap_free(&ccp->cc_sgmap, a);
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
alpha_sgmap_free(map, &ccp->cc_sgmap);
|
||||
|
||||
free(a, M_DEVBUF);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: dwlpx_dma.c,v 1.4 1998/01/17 03:40:33 thorpej Exp $ */
|
||||
/* $NetBSD: dwlpx_dma.c,v 1.5 1998/01/17 21:53:58 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.4 1998/01/17 03:40:33 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.5 1998/01/17 21:53:58 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -278,7 +278,6 @@ dwlpx_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
bus_dmamap_t *dmamp;
|
||||
{
|
||||
struct dwlpx_config *ccp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
||||
@ -289,15 +288,6 @@ dwlpx_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
|
||||
map = *dmamp;
|
||||
|
||||
a = malloc(sizeof(struct alpha_sgmap_cookie), M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
if (a == NULL) {
|
||||
_bus_dmamap_destroy(t, map);
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(a, sizeof(struct alpha_sgmap_cookie));
|
||||
map->_dm_sgcookie = a;
|
||||
|
||||
if (flags & BUS_DMA_ALLOCNOW) {
|
||||
error = alpha_sgmap_alloc(map, round_page(size),
|
||||
&ccp->cc_sgmap, flags);
|
||||
@ -317,12 +307,10 @@ dwlpx_bus_dmamap_destroy_sgmap(t, map)
|
||||
bus_dmamap_t map;
|
||||
{
|
||||
struct dwlpx_config *ccp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
alpha_sgmap_free(&ccp->cc_sgmap, a);
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
alpha_sgmap_free(map, &ccp->cc_sgmap);
|
||||
|
||||
free(a, M_DEVBUF);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: lca_dma.c,v 1.4 1998/01/17 03:40:33 thorpej Exp $ */
|
||||
/* $NetBSD: lca_dma.c,v 1.5 1998/01/17 21:53:58 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: lca_dma.c,v 1.4 1998/01/17 03:40:33 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lca_dma.c,v 1.5 1998/01/17 21:53:58 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -248,7 +248,6 @@ lca_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
bus_dmamap_t *dmamp;
|
||||
{
|
||||
struct lca_config *lcp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
||||
@ -259,15 +258,6 @@ lca_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
|
||||
map = *dmamp;
|
||||
|
||||
a = malloc(sizeof(struct alpha_sgmap_cookie), M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
if (a == NULL) {
|
||||
_bus_dmamap_destroy(t, map);
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(a, sizeof(struct alpha_sgmap_cookie));
|
||||
map->_dm_sgcookie = a;
|
||||
|
||||
if (flags & BUS_DMA_ALLOCNOW) {
|
||||
error = alpha_sgmap_alloc(map, round_page(size),
|
||||
&lcp->lc_sgmap, flags);
|
||||
@ -287,12 +277,10 @@ lca_bus_dmamap_destroy_sgmap(t, map)
|
||||
bus_dmamap_t map;
|
||||
{
|
||||
struct lca_config *lcp = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
alpha_sgmap_free(&lcp->lc_sgmap, a);
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
alpha_sgmap_free(map, &lcp->lc_sgmap);
|
||||
|
||||
free(a, M_DEVBUF);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: tc_dma_3000_500.c,v 1.3 1997/09/02 13:20:31 thorpej Exp $ */
|
||||
/* $NetBSD: tc_dma_3000_500.c,v 1.4 1998/01/17 21:53:59 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_dma_3000_500.c,v 1.3 1997/09/02 13:20:31 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_dma_3000_500.c,v 1.4 1998/01/17 21:53:59 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -125,7 +125,6 @@ tc_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
bus_dmamap_t *dmamp;
|
||||
{
|
||||
struct tc_dma_slot_info *tdsi = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
||||
@ -136,15 +135,6 @@ tc_bus_dmamap_create_sgmap(t, size, nsegments, maxsegsz, boundary,
|
||||
|
||||
map = *dmamp;
|
||||
|
||||
a = malloc(sizeof(struct alpha_sgmap_cookie), M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
if (a == NULL) {
|
||||
_bus_dmamap_destroy(t, map);
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(a, sizeof(struct alpha_sgmap_cookie));
|
||||
map->_dm_sgcookie = a;
|
||||
|
||||
if (flags & BUS_DMA_ALLOCNOW) {
|
||||
error = alpha_sgmap_alloc(map, round_page(size),
|
||||
&tdsi->tdsi_sgmap, flags);
|
||||
@ -164,12 +154,10 @@ tc_bus_dmamap_destroy_sgmap(t, map)
|
||||
bus_dmamap_t map;
|
||||
{
|
||||
struct tc_dma_slot_info *tdsi = t->_cookie;
|
||||
struct alpha_sgmap_cookie *a = map->_dm_sgcookie;
|
||||
|
||||
if (a->apdc_flags & APDC_HAS_SGMAP)
|
||||
alpha_sgmap_free(&tdsi->tdsi_sgmap, a);
|
||||
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
|
||||
alpha_sgmap_free(map, &tdsi->tdsi_sgmap);
|
||||
|
||||
free(a, M_DEVBUF);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user