From 83b3d2b7b6061bfa7d433fac12d52ba53307d5de Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 9 Mar 2013 21:24:32 +0100 Subject: 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. --- sys/arch/amd64/amd64/sg_dma.c | 12 ++++++++++++ sys/arch/amd64/include/bus.h | 1 + sys/arch/amd64/pci/agp_machdep.c | 6 ++++++ sys/arch/i386/i386/sg_dma.c | 12 ++++++++++++ sys/arch/i386/include/bus.h | 2 +- sys/arch/i386/pci/agp_machdep.c | 6 ++++++ sys/dev/pci/agpvar.h | 1 + 7 files changed, 39 insertions(+), 1 deletion(-) (limited to 'sys') 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 *); -- cgit v1.2.3