aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/busdma_machdep.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c
index 152fec591417..36c8d1f78315 100644
--- a/sys/x86/x86/busdma_machdep.c
+++ b/sys/x86/x86/busdma_machdep.c
@@ -238,6 +238,60 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
return (error);
}
+void
+bus_dma_template_init(bus_dma_tag_template_t *t, bus_dma_tag_t parent)
+{
+
+ if (t == NULL)
+ return;
+
+ t->parent = parent;
+ t->alignment = 1;
+ t->boundary = 0;
+ t->lowaddr = t->highaddr = BUS_SPACE_MAXADDR;
+ t->maxsize = t->maxsegsize = BUS_SPACE_MAXSIZE;
+ t->nsegments = BUS_SPACE_UNRESTRICTED;
+ t->lockfunc = NULL;
+ t->lockfuncarg = NULL;
+ t->flags = 0;
+}
+
+int
+bus_dma_template_tag(bus_dma_tag_template_t *t, bus_dma_tag_t *dmat)
+{
+
+ if (t == NULL || dmat == NULL)
+ return (EINVAL);
+
+ return (bus_dma_tag_create(t->parent, t->alignment, t->boundary,
+ t->lowaddr, t->highaddr, NULL, NULL, t->maxsize,
+ t->nsegments, t->maxsegsize, t->flags, t->lockfunc, t->lockfuncarg,
+ dmat));
+}
+
+void
+bus_dma_template_clone(bus_dma_tag_template_t *t, bus_dma_tag_t dmat)
+{
+ struct bus_dma_tag_common *common;
+
+ if (t == NULL || dmat == NULL)
+ return;
+
+ common = (struct bus_dma_tag_common *)dmat;
+
+ t->parent = (bus_dma_tag_t)common->parent;
+ t->alignment = common->alignment;
+ t->boundary = common->boundary;
+ t->lowaddr = common->lowaddr;
+ t->highaddr = common->highaddr;
+ t->maxsize = common->maxsize;
+ t->nsegments = common->nsegments;
+ t->maxsegsize = common->maxsegsz;
+ t->flags = common->flags;
+ t->lockfunc = common->lockfunc;
+ t->lockfuncarg = common->lockfuncarg;
+}
+
int
bus_dma_tag_destroy(bus_dma_tag_t dmat)
{