summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@openbsd.org>2013-03-09 21:24:32 +0100
committerMark Kettenis <kettenis@openbsd.org>2013-03-09 21:24:32 +0100
commit83b3d2b7b6061bfa7d433fac12d52ba53307d5de (patch)
tree5c006c75e484c37f1670da9a0f9ab71b2df64862 /sys
parent768d1405f03981babd048b6b48b94c443cc85b97 (diff)
Add agp_bus_dma_rebind(), and interface to re-enter mappings into the GART/GTT
when we resume or want to change for example the cachability of the mapping.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/sg_dma.c12
-rw-r--r--sys/arch/amd64/include/bus.h1
-rw-r--r--sys/arch/amd64/pci/agp_machdep.c6
-rw-r--r--sys/arch/i386/i386/sg_dma.c12
-rw-r--r--sys/arch/i386/include/bus.h2
-rw-r--r--sys/arch/i386/pci/agp_machdep.c6
-rw-r--r--sys/dev/pci/agpvar.h1
7 files changed, 39 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/sg_dma.c b/sys/arch/amd64/amd64/sg_dma.c
index 67d6eee4659..79853971117 100644
--- a/sys/arch/amd64/amd64/sg_dma.c
+++ b/sys/arch/amd64/amd64/sg_dma.c
@@ -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 5c8fab5b0bc..8dddac3ccb0 100644
--- a/sys/arch/amd64/include/bus.h
+++ b/sys/arch/amd64/include/bus.h
@@ -670,6 +670,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..ee3bd4671a7 100644
--- a/sys/arch/amd64/pci/agp_machdep.c
+++ b/sys/arch/amd64/pci/agp_machdep.c
@@ -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..8ae3ae976df 100644
--- a/sys/arch/i386/i386/sg_dma.c
+++ b/sys/arch/i386/i386/sg_dma.c
@@ -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 a6f92620a44..4e96f614637 100644
--- a/sys/arch/i386/include/bus.h
+++ b/sys/arch/i386/include/bus.h
@@ -679,8 +679,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..7d69152b9ac 100644
--- a/sys/arch/i386/pci/agp_machdep.c
+++ b/sys/arch/i386/pci/agp_machdep.c
@@ -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;
diff --git a/sys/dev/pci/agpvar.h b/sys/dev/pci/agpvar.h
index 21927155e51..cf6e5fce065 100644
--- a/sys/dev/pci/agpvar.h
+++ b/sys/dev/pci/agpvar.h
@@ -193,6 +193,7 @@ int agp_bus_dma_init(struct agp_softc *, bus_addr_t, bus_addr_t,
void agp_bus_dma_destroy(struct agp_softc *, bus_dma_tag_t);
void agp_bus_dma_set_alignment(bus_dma_tag_t, bus_dmamap_t,
u_long);
+void agp_bus_dma_rebind(bus_dma_tag_t, bus_dmamap_t, int);
void *agp_map(struct agp_softc *, bus_addr_t, bus_size_t,
bus_space_handle_t *);