summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-05-10 22:06:05 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-05-10 22:06:05 +0000
commitd9d23b0b11c7a51da943ddc4f3f8830d25a9a736 (patch)
tree3212c1bf78d2c943e10fb1278f71eda2c0b01090 /sys/dev
parent3904221c8b5efb0b07a4c465b2c0f8131e09fe2a (diff)
Continue with the horrible habit of using agp_machdep.c for agp related MD
things that there really isn't a decent api for elsewhere. Since on recent intel IGPs the gtt aperture is too big (256meg is not uncommon) to be mapped on a kva-constrained arch like i386, introduce an agp mapping api that does things depending on arch. On amd64 which can afford the space (and will use the direct mapping again soon)just do bus_space_map() on init, then parcels things out using bus_space_subregion(), thus avoiding map/unmap overhead on every call (this is how inteldrm does things right now). On i386, we do bus_space_map() and bus_space_unmap as appropriate. Linux has some tricks here involving ``atomic'' maps that are on only one cpu and that you may not sleep with to avoid the ipi overhead for tlb flushing. For now we don't go down that route but it is being considered. I am also considering if it is worth abstracting this a little more, improving the api and making it a general MD interface. Tested by myself on i386 and amd64 and by drahn@ (who has one of the machines with an aperture that is too big) on i386.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/agpvar.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/pci/agpvar.h b/sys/dev/pci/agpvar.h
index e9a3bb0ab37..2a9f6be4694 100644
--- a/sys/dev/pci/agpvar.h
+++ b/sys/dev/pci/agpvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: agpvar.h,v 1.21 2010/04/08 01:26:44 oga Exp $ */
+/* $OpenBSD: agpvar.h,v 1.22 2010/05/10 22:06:04 oga Exp $ */
/* $NetBSD: agpvar.h,v 1.4 2001/10/01 21:54:48 fvdl Exp $ */
/*-
@@ -148,6 +148,8 @@ struct agp_gatt {
size_t ag_size;
};
+struct agp_map;
+
/*
* Functions private to the AGP code.
*/
@@ -162,6 +164,13 @@ void agp_flush_cache_range(vaddr_t, vsize_t);
int agp_generic_bind_memory(struct agp_softc *, struct agp_memory *,
bus_size_t);
int agp_generic_unbind_memory(struct agp_softc *, struct agp_memory *);
+int agp_init_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, struct
+ agp_map **);
+void agp_destroy_map(struct agp_map *);
+int agp_map_subregion(struct agp_map *, bus_size_t, bus_size_t,
+ bus_space_handle_t *);
+void agp_unmap_subregion(struct agp_map *, bus_space_handle_t,
+ bus_size_t);
int agp_alloc_dmamem(bus_dma_tag_t, size_t, bus_dmamap_t *,
bus_addr_t *, bus_dma_segment_t *);