first step to make dbdma less hackish
- dbdma_alloc gets a new parameter to return the actual address of the buffer before being alignment-mangled so we can properly free it - add dbdma_free which takes the pointer mentioned above dbdma should really use bus_dma
This commit is contained in:
parent
4523c25649
commit
30ed9f0405
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dbdma.c,v 1.11 2012/05/23 21:47:23 macallan Exp $ */
|
||||
/* $NetBSD: dbdma.c,v 1.12 2016/07/15 21:08:27 macallan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1991-1998 by Open Software Foundation, Inc.
|
||||
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbdma.c,v 1.11 2012/05/23 21:47:23 macallan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbdma.c,v 1.12 2016/07/15 21:08:27 macallan Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kmem.h>
|
||||
|
@ -115,12 +115,21 @@ dbdma_pause(dbdma_regmap_t *dmap)
|
|||
}
|
||||
|
||||
dbdma_command_t *
|
||||
dbdma_alloc(int size)
|
||||
dbdma_alloc(int size, void **fp)
|
||||
{
|
||||
u_int buf;
|
||||
|
||||
buf = (u_int)kmem_alloc(size + 0x0f, KM_SLEEP);
|
||||
if (fp != NULL) {
|
||||
*fp = (void *)buf;
|
||||
}
|
||||
buf = (buf + 0x0f) & ~0x0f;
|
||||
|
||||
return (dbdma_command_t *)buf;
|
||||
}
|
||||
|
||||
void
|
||||
dbdma_free(void *ptr, int size)
|
||||
{
|
||||
kmem_free(ptr, size + 0x0f);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dbdma.h,v 1.5 2007/10/17 19:55:18 garbled Exp $ */
|
||||
/* $NetBSD: dbdma.h,v 1.6 2016/07/15 21:08:27 macallan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1991-1998 by Open Software Foundation, Inc.
|
||||
|
@ -166,6 +166,7 @@ void dbdma_reset(dbdma_regmap_t *channel);
|
|||
void dbdma_continue(dbdma_regmap_t *channel);
|
||||
void dbdma_pause(dbdma_regmap_t *channel);
|
||||
|
||||
dbdma_command_t *dbdma_alloc(int); /* Allocate command structures */
|
||||
dbdma_command_t *dbdma_alloc(int, void **); /* Allocate command structures */
|
||||
void dbdma_free(void *, int);
|
||||
|
||||
#endif /* !defined(_POWERMAC_DBDMA_H_) */
|
||||
|
|
Loading…
Reference in New Issue