summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-03-17 21:49:01 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-03-17 21:49:01 +0000
commitc0468ed3299fbaf7d9a8297819aa20988df0c046 (patch)
tree9b6e563b8c337d107cb75b3dc598763f8008903c /sys/arch
parent3d248ffcc532f23446d733f35b96ea1fcf0fadb3 (diff)
Add an interface to rebind AGP DMA mappings. To be used by the upcoming KMS
support to reload bindings after suspend/resume and to update cachability flags in the address translation table entries.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/sg_dma.c14
-rw-r--r--sys/arch/amd64/include/bus.h3
-rw-r--r--sys/arch/amd64/pci/agp_machdep.c8
-rw-r--r--sys/arch/i386/i386/sg_dma.c14
-rw-r--r--sys/arch/i386/include/bus.h4
-rw-r--r--sys/arch/i386/pci/agp_machdep.c8
6 files changed, 44 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/sg_dma.c b/sys/arch/amd64/amd64/sg_dma.c
index 67d6eee4659..7f5f33e4a73 100644
--- a/sys/arch/amd64/amd64/sg_dma.c
+++ b/sys/arch/amd64/amd64/sg_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sg_dma.c,v 1.10 2011/04/07 15:30:13 miod Exp $ */
+/* $OpenBSD: sg_dma.c,v 1.11 2013/03/17 21:49:00 kettenis Exp $ */
/*
* Copyright (c) 2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -786,6 +786,18 @@ sg_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
_bus_dmamap_unload(t, map);
}
+/*
+ * Reload a dvmamap.
+ */
+void
+sg_dmamap_reload(bus_dma_tag_t t, bus_dmamap_t map, int flags)
+{
+ struct sg_cookie *is = t->_cookie;
+ struct sg_page_map *spm = map->_dm_cookie;
+
+ sg_iomap_load_map(is, spm, spm->spm_start, flags);
+}
+
/*
* Alloc dma safe memory, telling the backend that we're scatter gather
* to ease pressure on the vm.
diff --git a/sys/arch/amd64/include/bus.h b/sys/arch/amd64/include/bus.h
index 4cd23ba63ad..4ae57e5c31b 100644
--- a/sys/arch/amd64/include/bus.h
+++ b/sys/arch/amd64/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.28 2013/01/29 01:15:57 dlg Exp $ */
+/* $OpenBSD: bus.h,v 1.29 2013/03/17 21:49:00 kettenis Exp $ */
/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
/*-
@@ -753,6 +753,7 @@ int sg_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
struct proc *, int, int *, int);
int sg_dmamap_load_physarray(bus_dma_tag_t, bus_dmamap_t, paddr_t *,
int, int, int *, int);
+void sg_dmamap_reload(bus_dma_tag_t, bus_dmamap_t, int);
int sg_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
bus_dma_segment_t *, int, int *, int);
diff --git a/sys/arch/amd64/pci/agp_machdep.c b/sys/arch/amd64/pci/agp_machdep.c
index 94a94d5fdb7..b59377e28f2 100644
--- a/sys/arch/amd64/pci/agp_machdep.c
+++ b/sys/arch/amd64/pci/agp_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_machdep.c,v 1.6 2010/05/10 22:06:04 oga Exp $ */
+/* $OpenBSD: agp_machdep.c,v 1.7 2013/03/17 21:49:00 kettenis Exp $ */
/*
* Copyright (c) 2008 - 2009 Owain G. Ainsworth <oga@openbsd.org>
@@ -174,6 +174,12 @@ agp_bus_dma_set_alignment(bus_dma_tag_t tag, bus_dmamap_t dmam,
sg_dmamap_set_alignment(tag, dmam, alignment);
}
+void
+agp_bus_dma_rebind(bus_dma_tag_t tag, bus_dmamap_t dmam, int flags)
+{
+ sg_dmamap_reload(tag, dmam, flags);
+}
+
struct agp_map {
bus_space_tag_t bst;
bus_space_handle_t bsh;
diff --git a/sys/arch/i386/i386/sg_dma.c b/sys/arch/i386/i386/sg_dma.c
index 1f45bf21c83..afbfb0aa0ad 100644
--- a/sys/arch/i386/i386/sg_dma.c
+++ b/sys/arch/i386/i386/sg_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sg_dma.c,v 1.7 2011/04/07 15:30:15 miod Exp $ */
+/* $OpenBSD: sg_dma.c,v 1.8 2013/03/17 21:49:00 kettenis Exp $ */
/*
* Copyright (c) 2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -786,6 +786,18 @@ sg_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
_bus_dmamap_unload(t, map);
}
+/*
+ * Reload a dvmamap.
+ */
+void
+sg_dmamap_reload(bus_dma_tag_t t, bus_dmamap_t map, int flags)
+{
+ struct sg_cookie *is = t->_cookie;
+ struct sg_page_map *spm = map->_dm_cookie;
+
+ sg_iomap_load_map(is, spm, spm->spm_start, flags);
+}
+
/*
* Alloc dma safe memory, telling the backend that we're scatter gather
* to ease pressure on the vm.
diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h
index a6b79e9333a..a0bfb337f98 100644
--- a/sys/arch/i386/include/bus.h
+++ b/sys/arch/i386/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.57 2013/01/29 01:15:57 dlg Exp $ */
+/* $OpenBSD: bus.h,v 1.58 2013/03/17 21:49:00 kettenis Exp $ */
/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
/*-
@@ -693,8 +693,8 @@ int sg_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
struct proc *, int, int *, int);
int sg_dmamap_load_physarray(bus_dma_tag_t, bus_dmamap_t, paddr_t *,
int, int, int *, int);
+void sg_dmamap_reload(bus_dma_tag_t, bus_dmamap_t, int);
int sg_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
bus_dma_segment_t *, int, int *, int);
-
#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/i386/pci/agp_machdep.c b/sys/arch/i386/pci/agp_machdep.c
index e6eaa41a00c..c6634a99dc4 100644
--- a/sys/arch/i386/pci/agp_machdep.c
+++ b/sys/arch/i386/pci/agp_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_machdep.c,v 1.12 2010/05/10 22:06:04 oga Exp $ */
+/* $OpenBSD: agp_machdep.c,v 1.13 2013/03/17 21:49:00 kettenis Exp $ */
/*
* Copyright (c) 2008 - 2009 Owain G. Ainsworth <oga@openbsd.org>
@@ -174,6 +174,12 @@ agp_bus_dma_set_alignment(bus_dma_tag_t tag, bus_dmamap_t dmam,
sg_dmamap_set_alignment(tag, dmam, alignment);
}
+void
+agp_bus_dma_rebind(bus_dma_tag_t tag, bus_dmamap_t dmam, int flags)
+{
+ sg_dmamap_reload(tag, dmam, flags);
+}
+
struct agp_map {
bus_space_tag_t bst;
bus_addr_t addr;