aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/x86/busdma_machdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/x86/x86/busdma_machdep.c')
-rw-r--r--sys/x86/x86/busdma_machdep.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c
index e6a181292ca9..a7eaee042a6f 100644
--- a/sys/x86/x86/busdma_machdep.c
+++ b/sys/x86/x86/busdma_machdep.c
@@ -43,8 +43,12 @@ __FBSDID("$FreeBSD$");
#include <sys/memdesc.h>
#include <sys/mutex.h>
#include <sys/uio.h>
+#include <sys/vmmeter.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
+#include <vm/vm_param.h>
+#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/pmap.h>
#include <machine/bus.h>
#include <x86/include/busdma_impl.h>
@@ -180,12 +184,29 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *parent,
common->filterarg = parent->filterarg;
common->parent = parent->parent;
}
+ common->domain = parent->domain;
atomic_add_int(&parent->ref_count, 1);
}
+ common->domain = vm_phys_domain_match(common->domain, 0ul,
+ common->lowaddr);
*dmat = common;
return (0);
}
+int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+ struct bus_dma_tag_common *tc;
+
+ tc = (struct bus_dma_tag_common *)dmat;
+ domain = vm_phys_domain_match(domain, 0ul, tc->lowaddr);
+ /* Only call the callback if it changes. */
+ if (domain == tc->domain)
+ return (0);
+ tc->domain = domain;
+ return (tc->impl->tag_set_domain(dmat));
+}
+
/*
* Allocate a device specific dma_tag.
*/