Prefix the members of struct bus_space_tag and struct bus_dma_tag with
a uniqifier. No functional changes.
This commit is contained in:
parent
586864e29d
commit
08707f05a0
@ -123,11 +123,11 @@ typedef u_long bus_size_t;
|
|||||||
typedef struct bus_space_tag *bus_space_tag_t;
|
typedef struct bus_space_tag *bus_space_tag_t;
|
||||||
|
|
||||||
struct bus_space_tag {
|
struct bus_space_tag {
|
||||||
void *cookie;
|
void *bst_cookie;
|
||||||
bus_space_tag_t parent;
|
bus_space_tag_t bst_parent;
|
||||||
int type;
|
int bst_type;
|
||||||
|
|
||||||
void (*bus_barrier)(bus_space_tag_t, bus_space_handle_t,
|
void (*bst_bus_barrier)(bus_space_tag_t, bus_space_handle_t,
|
||||||
bus_size_t, bus_size_t, int);
|
bus_size_t, bus_size_t, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -149,14 +149,14 @@ static void bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
|||||||
/* This macro finds the first "upstream" implementation of method `f' */
|
/* This macro finds the first "upstream" implementation of method `f' */
|
||||||
#define _BS_CALL(t,f) \
|
#define _BS_CALL(t,f) \
|
||||||
while (t->f == NULL) \
|
while (t->f == NULL) \
|
||||||
t = t->parent; \
|
t = t->bst_parent; \
|
||||||
return (*(t)->f)
|
return (*(t)->f)
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
||||||
bus_size_t s, int f)
|
bus_size_t s, int f)
|
||||||
{
|
{
|
||||||
_BS_CALL(t, bus_barrier)(t, h, o, s, f);
|
_BS_CALL(t, bst_bus_barrier)(t, h, o, s, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flags for bus space map functions */
|
/* flags for bus space map functions */
|
||||||
@ -193,7 +193,7 @@ bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read", 1);
|
__BUS_DEBUG_ACCESS(h, o, "read", 1);
|
||||||
return (lduba_nc((caddr_t)(h + o), bus_type_asi[t->type]));
|
return (lduba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint16_t
|
static __inline uint16_t
|
||||||
@ -201,7 +201,7 @@ bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read", 2);
|
__BUS_DEBUG_ACCESS(h, o, "read", 2);
|
||||||
return (lduha_nc((caddr_t)(h + o), bus_type_asi[t->type]));
|
return (lduha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint32_t
|
static __inline uint32_t
|
||||||
@ -209,7 +209,7 @@ bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read", 4);
|
__BUS_DEBUG_ACCESS(h, o, "read", 4);
|
||||||
return (lduwa_nc((caddr_t)(h + o), bus_type_asi[t->type]));
|
return (lduwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint64_t
|
static __inline uint64_t
|
||||||
@ -217,7 +217,7 @@ bus_space_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read", 8);
|
__BUS_DEBUG_ACCESS(h, o, "read", 8);
|
||||||
return (ldxa_nc((caddr_t)(h + o), bus_type_asi[t->type]));
|
return (ldxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -262,7 +262,7 @@ bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write", 1);
|
__BUS_DEBUG_ACCESS(h, o, "write", 1);
|
||||||
stba_nc((caddr_t)(h + o), bus_type_asi[t->type], v);
|
stba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -271,7 +271,7 @@ bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write", 2);
|
__BUS_DEBUG_ACCESS(h, o, "write", 2);
|
||||||
stha_nc((caddr_t)(h + o), bus_type_asi[t->type], v);
|
stha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -280,7 +280,7 @@ bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write", 4);
|
__BUS_DEBUG_ACCESS(h, o, "write", 4);
|
||||||
stwa_nc((caddr_t)(h + o), bus_type_asi[t->type], v);
|
stwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -289,7 +289,7 @@ bus_space_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write", 8);
|
__BUS_DEBUG_ACCESS(h, o, "write", 8);
|
||||||
stxa_nc((caddr_t)(h + o), bus_type_asi[t->type], v);
|
stxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -497,7 +497,7 @@ bus_space_read_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read stream", 1);
|
__BUS_DEBUG_ACCESS(h, o, "read stream", 1);
|
||||||
return (lduba_nc((caddr_t)(h + o), bus_stream_asi[t->type]));
|
return (lduba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint16_t
|
static __inline uint16_t
|
||||||
@ -505,7 +505,7 @@ bus_space_read_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read stream", 2);
|
__BUS_DEBUG_ACCESS(h, o, "read stream", 2);
|
||||||
return (lduha_nc((caddr_t)(h + o), bus_stream_asi[t->type]));
|
return (lduha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint32_t
|
static __inline uint32_t
|
||||||
@ -513,7 +513,7 @@ bus_space_read_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read stream", 4);
|
__BUS_DEBUG_ACCESS(h, o, "read stream", 4);
|
||||||
return (lduwa_nc((caddr_t)(h + o), bus_stream_asi[t->type]));
|
return (lduwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline uint64_t
|
static __inline uint64_t
|
||||||
@ -521,7 +521,7 @@ bus_space_read_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "read stream", 8);
|
__BUS_DEBUG_ACCESS(h, o, "read stream", 8);
|
||||||
return (ldxa_nc((caddr_t)(h + o), bus_stream_asi[t->type]));
|
return (ldxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -566,7 +566,7 @@ bus_space_write_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write stream", 1);
|
__BUS_DEBUG_ACCESS(h, o, "write stream", 1);
|
||||||
stba_nc((caddr_t)(h + o), bus_stream_asi[t->type], v);
|
stba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -575,7 +575,7 @@ bus_space_write_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write stream", 2);
|
__BUS_DEBUG_ACCESS(h, o, "write stream", 2);
|
||||||
stha_nc((caddr_t)(h + o), bus_stream_asi[t->type], v);
|
stha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -584,7 +584,7 @@ bus_space_write_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write stream", 4);
|
__BUS_DEBUG_ACCESS(h, o, "write stream", 4);
|
||||||
stwa_nc((caddr_t)(h + o), bus_stream_asi[t->type], v);
|
stwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -593,7 +593,7 @@ bus_space_write_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
|
|||||||
{
|
{
|
||||||
|
|
||||||
__BUS_DEBUG_ACCESS(h, o, "write stream", 8);
|
__BUS_DEBUG_ACCESS(h, o, "write stream", 8);
|
||||||
stxa_nc((caddr_t)(h + o), bus_stream_asi[t->type], v);
|
stxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
@ -926,43 +926,44 @@ typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int, bus_size_t
|
|||||||
* DMA for a given bus.
|
* DMA for a given bus.
|
||||||
*/
|
*/
|
||||||
struct bus_dma_tag {
|
struct bus_dma_tag {
|
||||||
void *cookie; /* cookie used in the guts */
|
void *dt_cookie; /* cookie used in the guts */
|
||||||
bus_dma_tag_t parent;
|
bus_dma_tag_t dt_parent;
|
||||||
bus_size_t alignment;
|
bus_size_t dt_alignment;
|
||||||
bus_size_t boundary;
|
bus_size_t dt_boundary;
|
||||||
bus_addr_t lowaddr;
|
bus_addr_t dt_lowaddr;
|
||||||
bus_addr_t highaddr;
|
bus_addr_t dt_highaddr;
|
||||||
bus_dma_filter_t *filter;
|
bus_dma_filter_t *dt_filter;
|
||||||
void *filterarg;
|
void *dt_filterarg;
|
||||||
bus_size_t maxsize;
|
bus_size_t dt_maxsize;
|
||||||
u_int nsegments;
|
int dt_nsegments;
|
||||||
bus_size_t maxsegsz;
|
bus_size_t dt_maxsegsz;
|
||||||
int flags;
|
int dt_flags;
|
||||||
int ref_count;
|
int dt_ref_count;
|
||||||
int map_count;
|
int dt_map_count;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DMA mapping methods.
|
* DMA mapping methods.
|
||||||
*/
|
*/
|
||||||
int (*dmamap_create)(bus_dma_tag_t, bus_dma_tag_t, int,
|
int (*dt_dmamap_create)(bus_dma_tag_t, bus_dma_tag_t, int,
|
||||||
bus_dmamap_t *);
|
bus_dmamap_t *);
|
||||||
int (*dmamap_destroy)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
|
int (*dt_dmamap_destroy)(bus_dma_tag_t, bus_dma_tag_t,
|
||||||
int (*dmamap_load)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
bus_dmamap_t);
|
||||||
|
int (*dt_dmamap_load)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
||||||
void *, bus_size_t, bus_dmamap_callback_t *, void *, int);
|
void *, bus_size_t, bus_dmamap_callback_t *, void *, int);
|
||||||
int (*dmamap_load_mbuf)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
int (*dt_dmamap_load_mbuf)(bus_dma_tag_t, bus_dma_tag_t,
|
||||||
struct mbuf *, bus_dmamap_callback2_t *, void *, int);
|
bus_dmamap_t, struct mbuf *, bus_dmamap_callback2_t *, void *, int);
|
||||||
int (*dmamap_load_uio)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
int (*dt_dmamap_load_uio)(bus_dma_tag_t, bus_dma_tag_t,
|
||||||
struct uio *, bus_dmamap_callback2_t *, void *, int);
|
bus_dmamap_t, struct uio *, bus_dmamap_callback2_t *, void *, int);
|
||||||
void (*dmamap_unload)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
|
void (*dt_dmamap_unload)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
|
||||||
void (*dmamap_sync)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
void (*dt_dmamap_sync)(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
||||||
bus_dmasync_op_t);
|
bus_dmasync_op_t);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DMA memory utility functions.
|
* DMA memory utility functions.
|
||||||
*/
|
*/
|
||||||
int (*dmamem_alloc)(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
int (*dt_dmamem_alloc)(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||||
bus_dmamap_t *);
|
bus_dmamap_t *);
|
||||||
void (*dmamem_free)(bus_dma_tag_t, bus_dma_tag_t, void *,
|
void (*dt_dmamem_free)(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||||
bus_dmamap_t);
|
bus_dmamap_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -989,9 +990,9 @@ sparc64_dmamap_create(bus_dma_tag_t pt, bus_dma_tag_t dt, int f,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_create == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_create == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamap_create)(lt, dt, f, p));
|
return ((*lt->dt_dmamap_create)(lt, dt, f, p));
|
||||||
}
|
}
|
||||||
#define bus_dmamap_create(t, f, p) \
|
#define bus_dmamap_create(t, f, p) \
|
||||||
sparc64_dmamap_create((t), (t), (f), (p))
|
sparc64_dmamap_create((t), (t), (f), (p))
|
||||||
@ -1001,9 +1002,9 @@ sparc64_dmamap_destroy(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t p)
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_destroy == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_destroy == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamap_destroy)(lt, dt, p));
|
return ((*lt->dt_dmamap_destroy)(lt, dt, p));
|
||||||
}
|
}
|
||||||
#define bus_dmamap_destroy(t, p) \
|
#define bus_dmamap_destroy(t, p) \
|
||||||
sparc64_dmamap_destroy((t), (t), (p))
|
sparc64_dmamap_destroy((t), (t), (p))
|
||||||
@ -1014,9 +1015,9 @@ sparc64_dmamap_load(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t m,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_load == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_load == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamap_load)(lt, dt, m, p, s, cb, cba, f));
|
return ((*lt->dt_dmamap_load)(lt, dt, m, p, s, cb, cba, f));
|
||||||
}
|
}
|
||||||
#define bus_dmamap_load(t, m, p, s, cb, cba, f) \
|
#define bus_dmamap_load(t, m, p, s, cb, cba, f) \
|
||||||
sparc64_dmamap_load((t), (t), (m), (p), (s), (cb), (cba), (f))
|
sparc64_dmamap_load((t), (t), (m), (p), (s), (cb), (cba), (f))
|
||||||
@ -1027,9 +1028,9 @@ sparc64_dmamap_load_mbuf(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t m,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_load_mbuf == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_load_mbuf == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamap_load_mbuf)(lt, dt, m, mb, cb, cba, f));
|
return ((*lt->dt_dmamap_load_mbuf)(lt, dt, m, mb, cb, cba, f));
|
||||||
}
|
}
|
||||||
#define bus_dmamap_load_mbuf(t, m, mb, cb, cba, f) \
|
#define bus_dmamap_load_mbuf(t, m, mb, cb, cba, f) \
|
||||||
sparc64_dmamap_load_mbuf((t), (t), (m), (mb), (cb), (cba), (f))
|
sparc64_dmamap_load_mbuf((t), (t), (m), (mb), (cb), (cba), (f))
|
||||||
@ -1040,9 +1041,9 @@ sparc64_dmamap_load_uio(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t m,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_load_uio == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_load_uio == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamap_load_uio)(lt, dt, m, ui, cb, cba, f));
|
return ((*lt->dt_dmamap_load_uio)(lt, dt, m, ui, cb, cba, f));
|
||||||
}
|
}
|
||||||
#define bus_dmamap_load_uio(t, m, ui, cb, cba, f) \
|
#define bus_dmamap_load_uio(t, m, ui, cb, cba, f) \
|
||||||
sparc64_dmamap_load_uio((t), (t), (m), (ui), (cb), (cba), (f))
|
sparc64_dmamap_load_uio((t), (t), (m), (ui), (cb), (cba), (f))
|
||||||
@ -1052,9 +1053,9 @@ sparc64_dmamap_unload(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t p)
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_unload == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_unload == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
(*lt->dmamap_unload)(lt, dt, p);
|
(*lt->dt_dmamap_unload)(lt, dt, p);
|
||||||
}
|
}
|
||||||
#define bus_dmamap_unload(t, p) \
|
#define bus_dmamap_unload(t, p) \
|
||||||
sparc64_dmamap_unload((t), (t), (p))
|
sparc64_dmamap_unload((t), (t), (p))
|
||||||
@ -1065,9 +1066,9 @@ sparc64_dmamap_sync(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t m,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamap_sync == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamap_sync == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
(*lt->dmamap_sync)(lt, dt, m, op);
|
(*lt->dt_dmamap_sync)(lt, dt, m, op);
|
||||||
}
|
}
|
||||||
#define bus_dmamap_sync(t, m, op) \
|
#define bus_dmamap_sync(t, m, op) \
|
||||||
sparc64_dmamap_sync((t), (t), (m), (op))
|
sparc64_dmamap_sync((t), (t), (m), (op))
|
||||||
@ -1078,9 +1079,9 @@ sparc64_dmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, void **v, int f,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamem_alloc == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamem_alloc == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
return ((*lt->dmamem_alloc)(lt, dt, v, f, m));
|
return ((*lt->dt_dmamem_alloc)(lt, dt, v, f, m));
|
||||||
}
|
}
|
||||||
#define bus_dmamem_alloc(t, v, f, m) \
|
#define bus_dmamem_alloc(t, v, f, m) \
|
||||||
sparc64_dmamem_alloc((t), (t), (v), (f), (m))
|
sparc64_dmamem_alloc((t), (t), (v), (f), (m))
|
||||||
@ -1091,9 +1092,9 @@ sparc64_dmamem_free(bus_dma_tag_t pt, bus_dma_tag_t dt, void *v,
|
|||||||
{
|
{
|
||||||
bus_dma_tag_t lt;
|
bus_dma_tag_t lt;
|
||||||
|
|
||||||
for (lt = pt; lt->dmamem_free == NULL; lt = lt->parent)
|
for (lt = pt; lt->dt_dmamem_free == NULL; lt = lt->dt_parent)
|
||||||
;
|
;
|
||||||
(*lt->dmamem_free)(lt, dt, v, m);
|
(*lt->dt_dmamem_free)(lt, dt, v, m);
|
||||||
}
|
}
|
||||||
#define bus_dmamem_free(t, v, m) \
|
#define bus_dmamem_free(t, v, m) \
|
||||||
sparc64_dmamem_free((t), (t), (v), (m))
|
sparc64_dmamem_free((t), (t), (v), (m))
|
||||||
|
@ -485,14 +485,14 @@ psycho_attach(device_t dev)
|
|||||||
0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_dmat) != 0)
|
0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_dmat) != 0)
|
||||||
panic("psycho_attach: bus_dma_tag_create failed");
|
panic("psycho_attach: bus_dma_tag_create failed");
|
||||||
/* Customize the tag */
|
/* Customize the tag */
|
||||||
sc->sc_dmat->cookie = sc;
|
sc->sc_dmat->dt_cookie = sc;
|
||||||
sc->sc_dmat->dmamap_create = psycho_dmamap_create;
|
sc->sc_dmat->dt_dmamap_create = psycho_dmamap_create;
|
||||||
sc->sc_dmat->dmamap_destroy = psycho_dmamap_destroy;
|
sc->sc_dmat->dt_dmamap_destroy = psycho_dmamap_destroy;
|
||||||
sc->sc_dmat->dmamap_load = psycho_dmamap_load;
|
sc->sc_dmat->dt_dmamap_load = psycho_dmamap_load;
|
||||||
sc->sc_dmat->dmamap_unload = psycho_dmamap_unload;
|
sc->sc_dmat->dt_dmamap_unload = psycho_dmamap_unload;
|
||||||
sc->sc_dmat->dmamap_sync = psycho_dmamap_sync;
|
sc->sc_dmat->dt_dmamap_sync = psycho_dmamap_sync;
|
||||||
sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc;
|
sc->sc_dmat->dt_dmamem_alloc = psycho_dmamem_alloc;
|
||||||
sc->sc_dmat->dmamem_free = psycho_dmamem_free;
|
sc->sc_dmat->dt_dmamem_free = psycho_dmamem_free;
|
||||||
/* XXX: register as root dma tag (kluge). */
|
/* XXX: register as root dma tag (kluge). */
|
||||||
sparc64_root_dma_tag = sc->sc_dmat;
|
sparc64_root_dma_tag = sc->sc_dmat;
|
||||||
|
|
||||||
@ -1298,9 +1298,9 @@ psycho_alloc_bus_tag(struct psycho_softc *sc, int type)
|
|||||||
panic("psycho_alloc_bus_tag: out of memory");
|
panic("psycho_alloc_bus_tag: out of memory");
|
||||||
|
|
||||||
bzero(bt, sizeof *bt);
|
bzero(bt, sizeof *bt);
|
||||||
bt->cookie = sc;
|
bt->bst_cookie = sc;
|
||||||
bt->parent = sc->sc_bustag;
|
bt->bst_parent = sc->sc_bustag;
|
||||||
bt->type = type;
|
bt->bst_type = type;
|
||||||
return (bt);
|
return (bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,7 +1313,7 @@ psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
return (iommu_dvmamem_alloc(pdmat, ddmat, sc->sc_is, vaddr, flags,
|
return (iommu_dvmamem_alloc(pdmat, ddmat, sc->sc_is, vaddr, flags,
|
||||||
mapp));
|
mapp));
|
||||||
}
|
}
|
||||||
@ -1324,7 +1324,7 @@ psycho_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
iommu_dvmamem_free(pdmat, ddmat, sc->sc_is, vaddr, map);
|
iommu_dvmamem_free(pdmat, ddmat, sc->sc_is, vaddr, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,7 +1334,7 @@ psycho_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
return (iommu_dvmamap_create(pdmat, ddmat, sc->sc_is, flags, mapp));
|
return (iommu_dvmamap_create(pdmat, ddmat, sc->sc_is, flags, mapp));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1345,7 +1345,7 @@ psycho_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
return (iommu_dvmamap_destroy(pdmat, ddmat, sc->sc_is, map));
|
return (iommu_dvmamap_destroy(pdmat, ddmat, sc->sc_is, map));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1356,7 @@ psycho_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
return (iommu_dvmamap_load(pdmat, ddmat, sc->sc_is, map, buf, buflen,
|
return (iommu_dvmamap_load(pdmat, ddmat, sc->sc_is, map, buf, buflen,
|
||||||
callback, callback_arg, flags));
|
callback, callback_arg, flags));
|
||||||
}
|
}
|
||||||
@ -1366,7 +1366,7 @@ psycho_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
iommu_dvmamap_unload(pdmat, ddmat, sc->sc_is, map);
|
iommu_dvmamap_unload(pdmat, ddmat, sc->sc_is, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,6 +1376,6 @@ psycho_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
{
|
{
|
||||||
struct psycho_softc *sc;
|
struct psycho_softc *sc;
|
||||||
|
|
||||||
sc = (struct psycho_softc *)pdmat->cookie;
|
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||||
iommu_dvmamap_sync(pdmat, ddmat, sc->sc_is, map, op);
|
iommu_dvmamap_sync(pdmat, ddmat, sc->sc_is, map, op);
|
||||||
}
|
}
|
||||||
|
@ -337,14 +337,14 @@ sbus_probe(device_t dev)
|
|||||||
0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_cdmatag) != 0)
|
0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_cdmatag) != 0)
|
||||||
panic("bus_dma_tag_create failed");
|
panic("bus_dma_tag_create failed");
|
||||||
/* Customize the tag */
|
/* Customize the tag */
|
||||||
sc->sc_cdmatag->cookie = sc;
|
sc->sc_cdmatag->dt_cookie = sc;
|
||||||
sc->sc_cdmatag->dmamap_create = sbus_dmamap_create;
|
sc->sc_cdmatag->dt_dmamap_create = sbus_dmamap_create;
|
||||||
sc->sc_cdmatag->dmamap_destroy = sbus_dmamap_destroy;
|
sc->sc_cdmatag->dt_dmamap_destroy = sbus_dmamap_destroy;
|
||||||
sc->sc_cdmatag->dmamap_load = sbus_dmamap_load;
|
sc->sc_cdmatag->dt_dmamap_load = sbus_dmamap_load;
|
||||||
sc->sc_cdmatag->dmamap_unload = sbus_dmamap_unload;
|
sc->sc_cdmatag->dt_dmamap_unload = sbus_dmamap_unload;
|
||||||
sc->sc_cdmatag->dmamap_sync = sbus_dmamap_sync;
|
sc->sc_cdmatag->dt_dmamap_sync = sbus_dmamap_sync;
|
||||||
sc->sc_cdmatag->dmamem_alloc = sbus_dmamem_alloc;
|
sc->sc_cdmatag->dt_dmamem_alloc = sbus_dmamem_alloc;
|
||||||
sc->sc_cdmatag->dmamem_free = sbus_dmamem_free;
|
sc->sc_cdmatag->dt_dmamem_free = sbus_dmamem_free;
|
||||||
/* XXX: register as root dma tag (kluge). */
|
/* XXX: register as root dma tag (kluge). */
|
||||||
sparc64_root_dma_tag = sc->sc_cdmatag;
|
sparc64_root_dma_tag = sc->sc_cdmatag;
|
||||||
|
|
||||||
@ -907,9 +907,9 @@ sbus_alloc_bustag(struct sbus_softc *sc)
|
|||||||
panic("sbus_alloc_bustag: out of memory");
|
panic("sbus_alloc_bustag: out of memory");
|
||||||
|
|
||||||
bzero(sbt, sizeof *sbt);
|
bzero(sbt, sizeof *sbt);
|
||||||
sbt->cookie = sc;
|
sbt->bst_cookie = sc;
|
||||||
sbt->parent = sc->sc_bustag;
|
sbt->bst_parent = sc->sc_bustag;
|
||||||
sbt->type = SBUS_BUS_SPACE;
|
sbt->bst_type = SBUS_BUS_SPACE;
|
||||||
return (sbt);
|
return (sbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ static int
|
|||||||
sbus_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
|
sbus_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
|
||||||
bus_dmamap_t *mapp)
|
bus_dmamap_t *mapp)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
return (iommu_dvmamap_create(pdmat, ddmat, &sc->sc_is, flags, mapp));
|
return (iommu_dvmamap_create(pdmat, ddmat, &sc->sc_is, flags, mapp));
|
||||||
|
|
||||||
@ -926,7 +926,7 @@ sbus_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
|
|||||||
static int
|
static int
|
||||||
sbus_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
sbus_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
return (iommu_dvmamap_destroy(pdmat, ddmat, &sc->sc_is, map));
|
return (iommu_dvmamap_destroy(pdmat, ddmat, &sc->sc_is, map));
|
||||||
}
|
}
|
||||||
@ -936,7 +936,7 @@ sbus_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
void *buf, bus_size_t buflen, bus_dmamap_callback_t *callback,
|
void *buf, bus_size_t buflen, bus_dmamap_callback_t *callback,
|
||||||
void *callback_arg, int flags)
|
void *callback_arg, int flags)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
return (iommu_dvmamap_load(pdmat, ddmat, &sc->sc_is, map, buf, buflen,
|
return (iommu_dvmamap_load(pdmat, ddmat, &sc->sc_is, map, buf, buflen,
|
||||||
callback, callback_arg, flags));
|
callback, callback_arg, flags));
|
||||||
@ -945,7 +945,7 @@ sbus_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
static void
|
static void
|
||||||
sbus_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
sbus_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
iommu_dvmamap_unload(pdmat, ddmat, &sc->sc_is, map);
|
iommu_dvmamap_unload(pdmat, ddmat, &sc->sc_is, map);
|
||||||
}
|
}
|
||||||
@ -954,7 +954,7 @@ static void
|
|||||||
sbus_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
sbus_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
||||||
bus_dmasync_op_t op)
|
bus_dmasync_op_t op)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
iommu_dvmamap_sync(pdmat, ddmat, &sc->sc_is, map, op);
|
iommu_dvmamap_sync(pdmat, ddmat, &sc->sc_is, map, op);
|
||||||
}
|
}
|
||||||
@ -963,7 +963,7 @@ static int
|
|||||||
sbus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
sbus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||||
int flags, bus_dmamap_t *mapp)
|
int flags, bus_dmamap_t *mapp)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
return (iommu_dvmamem_alloc(pdmat, ddmat, &sc->sc_is, vaddr, flags,
|
return (iommu_dvmamem_alloc(pdmat, ddmat, &sc->sc_is, vaddr, flags,
|
||||||
mapp));
|
mapp));
|
||||||
@ -973,7 +973,7 @@ static void
|
|||||||
sbus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
sbus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
||||||
bus_dmamap_t map)
|
bus_dmamap_t map)
|
||||||
{
|
{
|
||||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->cookie;
|
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||||
|
|
||||||
iommu_dvmamem_free(pdmat, ddmat, &sc->sc_is, vaddr, map);
|
iommu_dvmamem_free(pdmat, ddmat, &sc->sc_is, vaddr, map);
|
||||||
}
|
}
|
||||||
|
@ -200,41 +200,45 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
|||||||
if (newtag == NULL)
|
if (newtag == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
newtag->parent = parent != NULL ? parent : sparc64_root_dma_tag;
|
newtag->dt_parent = parent != NULL ? parent : sparc64_root_dma_tag;
|
||||||
newtag->alignment = alignment;
|
newtag->dt_alignment = alignment;
|
||||||
newtag->boundary = boundary;
|
newtag->dt_boundary = boundary;
|
||||||
newtag->lowaddr = trunc_page((vm_offset_t)lowaddr) + (PAGE_SIZE - 1);
|
newtag->dt_lowaddr = trunc_page((vm_offset_t)lowaddr) + (PAGE_SIZE - 1);
|
||||||
newtag->highaddr = trunc_page((vm_offset_t)highaddr) + (PAGE_SIZE - 1);
|
newtag->dt_highaddr = trunc_page((vm_offset_t)highaddr) +
|
||||||
newtag->filter = filter;
|
(PAGE_SIZE - 1);
|
||||||
newtag->filterarg = filterarg;
|
newtag->dt_filter = filter;
|
||||||
newtag->maxsize = maxsize;
|
newtag->dt_filterarg = filterarg;
|
||||||
newtag->nsegments = nsegments;
|
newtag->dt_maxsize = maxsize;
|
||||||
newtag->maxsegsz = maxsegsz;
|
newtag->dt_nsegments = nsegments;
|
||||||
newtag->flags = flags;
|
newtag->dt_maxsegsz = maxsegsz;
|
||||||
newtag->ref_count = 1; /* Count ourselves */
|
newtag->dt_flags = flags;
|
||||||
newtag->map_count = 0;
|
newtag->dt_ref_count = 1; /* Count ourselves */
|
||||||
|
newtag->dt_map_count = 0;
|
||||||
|
|
||||||
newtag->dmamap_create = NULL;
|
newtag->dt_dmamap_create = NULL;
|
||||||
newtag->dmamap_destroy = NULL;
|
newtag->dt_dmamap_destroy = NULL;
|
||||||
newtag->dmamap_load = NULL;
|
newtag->dt_dmamap_load = NULL;
|
||||||
newtag->dmamap_load_mbuf = NULL;
|
newtag->dt_dmamap_load_mbuf = NULL;
|
||||||
newtag->dmamap_load_uio = NULL;
|
newtag->dt_dmamap_load_uio = NULL;
|
||||||
newtag->dmamap_unload = NULL;
|
newtag->dt_dmamap_unload = NULL;
|
||||||
newtag->dmamap_sync = NULL;
|
newtag->dt_dmamap_sync = NULL;
|
||||||
newtag->dmamem_alloc = NULL;
|
newtag->dt_dmamem_alloc = NULL;
|
||||||
newtag->dmamem_free = NULL;
|
newtag->dt_dmamem_free = NULL;
|
||||||
|
|
||||||
/* Take into account any restrictions imposed by our parent tag */
|
/* Take into account any restrictions imposed by our parent tag */
|
||||||
if (parent != NULL) {
|
if (parent != NULL) {
|
||||||
newtag->lowaddr = ulmin(parent->lowaddr, newtag->lowaddr);
|
newtag->dt_lowaddr = ulmin(parent->dt_lowaddr,
|
||||||
newtag->highaddr = ulmax(parent->highaddr, newtag->highaddr);
|
newtag->dt_lowaddr);
|
||||||
|
newtag->dt_highaddr = ulmax(parent->dt_highaddr,
|
||||||
|
newtag->dt_highaddr);
|
||||||
/*
|
/*
|
||||||
* XXX Not really correct??? Probably need to honor boundary
|
* XXX Not really correct??? Probably need to honor boundary
|
||||||
* all the way up the inheritence chain.
|
* all the way up the inheritence chain.
|
||||||
*/
|
*/
|
||||||
newtag->boundary = ulmax(parent->boundary, newtag->boundary);
|
newtag->dt_boundary = ulmin(parent->dt_boundary,
|
||||||
|
newtag->dt_boundary);
|
||||||
}
|
}
|
||||||
newtag->parent->ref_count++;
|
newtag->dt_parent->dt_ref_count++;
|
||||||
|
|
||||||
*dmat = newtag;
|
*dmat = newtag;
|
||||||
return (0);
|
return (0);
|
||||||
@ -246,12 +250,12 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
|
|||||||
bus_dma_tag_t parent;
|
bus_dma_tag_t parent;
|
||||||
|
|
||||||
if (dmat != NULL) {
|
if (dmat != NULL) {
|
||||||
if (dmat->map_count != 0)
|
if (dmat->dt_map_count != 0)
|
||||||
return (EBUSY);
|
return (EBUSY);
|
||||||
while (dmat != NULL) {
|
while (dmat != NULL) {
|
||||||
parent = dmat->parent;
|
parent = dmat->dt_parent;
|
||||||
dmat->ref_count--;
|
dmat->dt_ref_count--;
|
||||||
if (dmat->ref_count == 0) {
|
if (dmat->dt_ref_count == 0) {
|
||||||
free(dmat, M_DEVBUF);
|
free(dmat, M_DEVBUF);
|
||||||
/*
|
/*
|
||||||
* Last reference count, so
|
* Last reference count, so
|
||||||
@ -278,7 +282,7 @@ nexus_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
|
|||||||
/* Not much to do...? */
|
/* Not much to do...? */
|
||||||
*mapp = malloc(sizeof(**mapp), M_DEVBUF, M_NOWAIT | M_ZERO);
|
*mapp = malloc(sizeof(**mapp), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||||
if (*mapp != NULL) {
|
if (*mapp != NULL) {
|
||||||
ddmat->map_count++;
|
ddmat->dt_map_count++;
|
||||||
return (0);
|
return (0);
|
||||||
} else
|
} else
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
@ -293,7 +297,7 @@ nexus_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
|
|||||||
{
|
{
|
||||||
|
|
||||||
free(map, M_DEVBUF);
|
free(map, M_DEVBUF);
|
||||||
ddmat->map_count--;
|
ddmat->dt_map_count--;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +321,7 @@ nexus_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
vm_offset_t vaddr;
|
vm_offset_t vaddr;
|
||||||
vm_offset_t paddr;
|
vm_offset_t paddr;
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
bus_dma_segment_t dm_segments[ddmat->nsegments];
|
bus_dma_segment_t dm_segments[ddmat->dt_nsegments];
|
||||||
#else
|
#else
|
||||||
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
||||||
#endif
|
#endif
|
||||||
@ -354,7 +358,7 @@ nexus_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
|||||||
/* Go to the next segment */
|
/* Go to the next segment */
|
||||||
sg++;
|
sg++;
|
||||||
seg++;
|
seg++;
|
||||||
if (seg > ddmat->nsegments)
|
if (seg > ddmat->dt_nsegments)
|
||||||
break;
|
break;
|
||||||
sg->ds_addr = paddr;
|
sg->ds_addr = paddr;
|
||||||
sg->ds_len = size;
|
sg->ds_len = size;
|
||||||
@ -399,7 +403,7 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
pmap = NULL;
|
pmap = NULL;
|
||||||
|
|
||||||
lastaddr = *lastaddrp;
|
lastaddr = *lastaddrp;
|
||||||
bmask = ~(ddmat->boundary - 1);
|
bmask = ~(ddmat->dt_boundary - 1);
|
||||||
|
|
||||||
for (seg = *segp; buflen > 0 ; ) {
|
for (seg = *segp; buflen > 0 ; ) {
|
||||||
/*
|
/*
|
||||||
@ -420,8 +424,8 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
/*
|
/*
|
||||||
* Make sure we don't cross any boundaries.
|
* Make sure we don't cross any boundaries.
|
||||||
*/
|
*/
|
||||||
if (ddmat->boundary > 0) {
|
if (ddmat->dt_boundary > 0) {
|
||||||
baddr = (curaddr + ddmat->boundary) & bmask;
|
baddr = (curaddr + ddmat->dt_boundary) & bmask;
|
||||||
if (sgsize > (baddr - curaddr))
|
if (sgsize > (baddr - curaddr))
|
||||||
sgsize = (baddr - curaddr);
|
sgsize = (baddr - curaddr);
|
||||||
}
|
}
|
||||||
@ -436,12 +440,12 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
first = 0;
|
first = 0;
|
||||||
} else {
|
} else {
|
||||||
if (curaddr == lastaddr &&
|
if (curaddr == lastaddr &&
|
||||||
(segs[seg].ds_len + sgsize) <= ddmat->maxsegsz &&
|
(segs[seg].ds_len + sgsize) <= ddmat->dt_maxsegsz &&
|
||||||
(ddmat->boundary == 0 ||
|
(ddmat->dt_boundary == 0 ||
|
||||||
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
(segs[seg].ds_addr & bmask) == (curaddr & bmask)))
|
||||||
segs[seg].ds_len += sgsize;
|
segs[seg].ds_len += sgsize;
|
||||||
else {
|
else {
|
||||||
if (++seg >= ddmat->nsegments)
|
if (++seg >= ddmat->dt_nsegments)
|
||||||
break;
|
break;
|
||||||
segs[seg].ds_addr = curaddr;
|
segs[seg].ds_addr = curaddr;
|
||||||
segs[seg].ds_len = sgsize;
|
segs[seg].ds_len = sgsize;
|
||||||
@ -471,7 +475,7 @@ nexus_dmamap_load_mbuf(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
void *callback_arg, int flags)
|
void *callback_arg, int flags)
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
bus_dma_segment_t dm_segments[ddmat->nsegments];
|
bus_dma_segment_t dm_segments[ddmat->dt_nsegments];
|
||||||
#else
|
#else
|
||||||
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
||||||
#endif
|
#endif
|
||||||
@ -482,7 +486,7 @@ nexus_dmamap_load_mbuf(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
|
|
||||||
nsegs = 0;
|
nsegs = 0;
|
||||||
error = 0;
|
error = 0;
|
||||||
if (m0->m_pkthdr.len <= ddmat->maxsize) {
|
if (m0->m_pkthdr.len <= ddmat->dt_maxsize) {
|
||||||
int first = 1;
|
int first = 1;
|
||||||
vm_offset_t lastaddr = 0;
|
vm_offset_t lastaddr = 0;
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
@ -517,7 +521,7 @@ nexus_dmamap_load_uio(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
|
|||||||
{
|
{
|
||||||
vm_offset_t lastaddr;
|
vm_offset_t lastaddr;
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
bus_dma_segment_t dm_segments[ddmat->nsegments];
|
bus_dma_segment_t dm_segments[ddmat->dt_nsegments];
|
||||||
#else
|
#else
|
||||||
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
|
||||||
#endif
|
#endif
|
||||||
@ -626,7 +630,7 @@ sparc64_dmamem_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp)
|
|||||||
if (*mapp == NULL)
|
if (*mapp == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
dmat->map_count++;
|
dmat->dt_map_count++;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +639,7 @@ sparc64_dmamem_free_map(bus_dma_tag_t dmat, bus_dmamap_t map)
|
|||||||
{
|
{
|
||||||
|
|
||||||
free(map, M_DEVBUF);
|
free(map, M_DEVBUF);
|
||||||
dmat->map_count--;
|
dmat->dt_map_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -647,8 +651,8 @@ nexus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
|||||||
int flags, bus_dmamap_t *mapp)
|
int flags, bus_dmamap_t *mapp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((ddmat->maxsize <= PAGE_SIZE)) {
|
if ((ddmat->dt_maxsize <= PAGE_SIZE)) {
|
||||||
*vaddr = malloc(ddmat->maxsize, M_DEVBUF,
|
*vaddr = malloc(ddmat->dt_maxsize, M_DEVBUF,
|
||||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -656,11 +660,11 @@ nexus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
|||||||
* and handles multi-seg allocations. Nobody is doing multi-seg
|
* and handles multi-seg allocations. Nobody is doing multi-seg
|
||||||
* allocations yet though.
|
* allocations yet though.
|
||||||
*/
|
*/
|
||||||
*vaddr = contigmalloc(ddmat->maxsize, M_DEVBUF,
|
*vaddr = contigmalloc(ddmat->dt_maxsize, M_DEVBUF,
|
||||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
|
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
|
||||||
0ul, ddmat->lowaddr,
|
0ul, ddmat->dt_lowaddr,
|
||||||
ddmat->alignment ? ddmat->alignment : 1UL,
|
ddmat->dt_alignment ? ddmat->dt_alignment : 1UL,
|
||||||
ddmat->boundary);
|
ddmat->dt_boundary);
|
||||||
}
|
}
|
||||||
if (*vaddr == NULL) {
|
if (*vaddr == NULL) {
|
||||||
free(*mapp, M_DEVBUF);
|
free(*mapp, M_DEVBUF);
|
||||||
@ -679,10 +683,10 @@ nexus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
|||||||
{
|
{
|
||||||
|
|
||||||
sparc64_dmamem_free_map(ddmat, map);
|
sparc64_dmamem_free_map(ddmat, map);
|
||||||
if ((ddmat->maxsize <= PAGE_SIZE))
|
if ((ddmat->dt_maxsize <= PAGE_SIZE))
|
||||||
free(vaddr, M_DEVBUF);
|
free(vaddr, M_DEVBUF);
|
||||||
else
|
else
|
||||||
contigfree(vaddr, ddmat->maxsize, M_DEVBUF);
|
contigfree(vaddr, ddmat->dt_maxsize, M_DEVBUF);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bus_dma_tag nexus_dmatag = {
|
struct bus_dma_tag nexus_dmatag = {
|
||||||
@ -732,7 +736,7 @@ sparc64_bus_mem_map(bus_space_tag_t tag, bus_space_handle_t handle,
|
|||||||
printf("sparc64_bus_map: zero size\n");
|
printf("sparc64_bus_map: zero size\n");
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
switch (tag->type) {
|
switch (tag->bst_type) {
|
||||||
case PCI_CONFIG_BUS_SPACE:
|
case PCI_CONFIG_BUS_SPACE:
|
||||||
case PCI_IO_BUS_SPACE:
|
case PCI_IO_BUS_SPACE:
|
||||||
case PCI_MEMORY_BUS_SPACE:
|
case PCI_MEMORY_BUS_SPACE:
|
||||||
@ -798,10 +802,10 @@ bus_space_handle_t
|
|||||||
sparc64_fake_bustag(int space, bus_addr_t addr, struct bus_space_tag *ptag)
|
sparc64_fake_bustag(int space, bus_addr_t addr, struct bus_space_tag *ptag)
|
||||||
{
|
{
|
||||||
|
|
||||||
ptag->cookie = NULL;
|
ptag->bst_cookie = NULL;
|
||||||
ptag->parent = NULL;
|
ptag->bst_parent = NULL;
|
||||||
ptag->type = space;
|
ptag->bst_type = space;
|
||||||
ptag->bus_barrier = NULL;
|
ptag->bst_bus_barrier = NULL;
|
||||||
return (addr);
|
return (addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,14 +498,14 @@ iommu_dvma_valloc(bus_dma_tag_t t, struct iommu_state *is, bus_dmamap_t map,
|
|||||||
* allocation code.
|
* allocation code.
|
||||||
* Alignment to a page boundary is always enforced.
|
* Alignment to a page boundary is always enforced.
|
||||||
*/
|
*/
|
||||||
align = (t->alignment + IO_PAGE_MASK) >> IO_PAGE_SHIFT;
|
align = (t->dt_alignment + IO_PAGE_MASK) >> IO_PAGE_SHIFT;
|
||||||
sgsize = round_io_page(size) >> IO_PAGE_SHIFT;
|
sgsize = round_io_page(size) >> IO_PAGE_SHIFT;
|
||||||
if (t->boundary > 0 && t->boundary < IO_PAGE_SIZE)
|
if (t->dt_boundary > 0 && t->dt_boundary < IO_PAGE_SIZE)
|
||||||
panic("iommu_dvmamap_load: illegal boundary specified");
|
panic("iommu_dvmamap_load: illegal boundary specified");
|
||||||
bound = ulmax(t->boundary >> IO_PAGE_SHIFT, 1);
|
bound = ulmax(t->dt_boundary >> IO_PAGE_SHIFT, 1);
|
||||||
map->dvmaresv = 0;
|
map->dvmaresv = 0;
|
||||||
map->res = rman_reserve_resource_bound(&iommu_dvma_rman, 0L,
|
map->res = rman_reserve_resource_bound(&iommu_dvma_rman, 0L,
|
||||||
t->lowaddr, sgsize, bound >> IO_PAGE_SHIFT,
|
t->dt_lowaddr, sgsize, bound >> IO_PAGE_SHIFT,
|
||||||
RF_ACTIVE | rman_make_alignment_flags(align), NULL);
|
RF_ACTIVE | rman_make_alignment_flags(align), NULL);
|
||||||
if (map->res == NULL)
|
if (map->res == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
@ -540,7 +540,7 @@ iommu_dvmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
*/
|
*/
|
||||||
if ((error = sparc64_dmamem_alloc_map(dt, mapp)) != 0)
|
if ((error = sparc64_dmamem_alloc_map(dt, mapp)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
if ((*vaddr = malloc(dt->maxsize, M_IOMMU,
|
if ((*vaddr = malloc(dt->dt_maxsize, M_IOMMU,
|
||||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) {
|
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) {
|
||||||
error = ENOMEM;
|
error = ENOMEM;
|
||||||
goto failm;
|
goto failm;
|
||||||
@ -549,7 +549,7 @@ iommu_dvmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
* Try to preallocate DVMA memory. If this fails, it is retried at load
|
* Try to preallocate DVMA memory. If this fails, it is retried at load
|
||||||
* time.
|
* time.
|
||||||
*/
|
*/
|
||||||
iommu_dvma_valloc(dt, is, *mapp, IOMMU_SIZE_ROUNDUP(dt->maxsize));
|
iommu_dvma_valloc(dt, is, *mapp, IOMMU_SIZE_ROUNDUP(dt->dt_maxsize));
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
failm:
|
failm:
|
||||||
@ -573,7 +573,7 @@ iommu_dvmamap_create(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if ((error = sparc64_dmamap_create(pt->parent, dt, flags, mapp)) != 0)
|
if ((error = sparc64_dmamap_create(pt->dt_parent, dt, flags, mapp)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
KASSERT((*mapp)->res == NULL,
|
KASSERT((*mapp)->res == NULL,
|
||||||
("iommu_dvmamap_create: hierarchy botched"));
|
("iommu_dvmamap_create: hierarchy botched"));
|
||||||
@ -584,7 +584,7 @@ iommu_dvmamap_create(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
* handle more; that case is handled by reallocating at map load time.
|
* handle more; that case is handled by reallocating at map load time.
|
||||||
*/
|
*/
|
||||||
iommu_dvma_valloc(dt, is, *mapp,
|
iommu_dvma_valloc(dt, is, *mapp,
|
||||||
ulmin(IOMMU_SIZE_ROUNDUP(dt->maxsize), BUS_SPACE_MAXSIZE));
|
ulmin(IOMMU_SIZE_ROUNDUP(dt->dt_maxsize), BUS_SPACE_MAXSIZE));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ iommu_dvmamap_destroy(bus_dma_tag_t pt, bus_dma_tag_t dt,
|
|||||||
{
|
{
|
||||||
|
|
||||||
iommu_dvma_vfree(map);
|
iommu_dvma_vfree(map);
|
||||||
return (sparc64_dmamap_destroy(pt->parent, dt, map));
|
return (sparc64_dmamap_destroy(pt->dt_parent, dt, map));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BUS_DMAMAP_NSEGS ((BUS_SPACE_MAXSIZE / PAGE_SIZE) + 1)
|
#define BUS_DMAMAP_NSEGS ((BUS_SPACE_MAXSIZE / PAGE_SIZE) + 1)
|
||||||
@ -608,7 +608,7 @@ iommu_dvmamap_load(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
void *cba, int flags)
|
void *cba, int flags)
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
bus_dma_segment_t sgs[dt->nsegments];
|
bus_dma_segment_t sgs[dt->dt_nsegments];
|
||||||
#else
|
#else
|
||||||
bus_dma_segment_t sgs[BUS_DMAMAP_NSEGS];
|
bus_dma_segment_t sgs[BUS_DMAMAP_NSEGS];
|
||||||
#endif
|
#endif
|
||||||
@ -626,7 +626,7 @@ iommu_dvmamap_load(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
#endif
|
#endif
|
||||||
bus_dmamap_unload(dt, map);
|
bus_dmamap_unload(dt, map);
|
||||||
}
|
}
|
||||||
if (buflen > dt->maxsize)
|
if (buflen > dt->dt_maxsize)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
maxsize = IOMMU_SIZE_ROUNDUP(buflen);
|
maxsize = IOMMU_SIZE_ROUNDUP(buflen);
|
||||||
@ -689,14 +689,14 @@ iommu_dvmamap_load(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
iommu_enter(is, trunc_io_page(dvmaddr), trunc_io_page(curaddr),
|
iommu_enter(is, trunc_io_page(dvmaddr), trunc_io_page(curaddr),
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
if (sgcnt == -1 || sgs[sgcnt].ds_len + sgsize > dt->maxsegsz) {
|
if (sgcnt == -1 || sgs[sgcnt].ds_len + sgsize > dt->dt_maxsegsz) {
|
||||||
if (sgsize > dt->maxsegsz) {
|
if (sgsize > dt->dt_maxsegsz) {
|
||||||
/* XXX: add fixup */
|
/* XXX: add fixup */
|
||||||
panic("iommu_dvmamap_load: magsegsz too "
|
panic("iommu_dvmamap_load: magsegsz too "
|
||||||
"small\n");
|
"small\n");
|
||||||
}
|
}
|
||||||
sgcnt++;
|
sgcnt++;
|
||||||
if (sgcnt > dt->nsegments || sgcnt > BUS_DMAMAP_NSEGS) {
|
if (sgcnt > dt->dt_nsegments || sgcnt > BUS_DMAMAP_NSEGS) {
|
||||||
error = ENOMEM;
|
error = ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -729,7 +729,7 @@ iommu_dvmamap_unload(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
|||||||
map->buflen = 0;
|
map->buflen = 0;
|
||||||
iommu_map_insq(map);
|
iommu_map_insq(map);
|
||||||
/* Flush the caches */
|
/* Flush the caches */
|
||||||
sparc64_dmamap_unload(pt->parent, dt, map);
|
sparc64_dmamap_unload(pt->dt_parent, dt, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user