summaryrefslogtreecommitdiff
path: root/bsd-core/drmP.h
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-04-26 05:19:11 +0000
committerEric Anholt <anholt@freebsd.org>2005-04-26 05:19:11 +0000
commitec111d70fee0647c4c68a02c723d4a3729c93b56 (patch)
tree114a3257310a979d3dea484af62322ba007bf1e0 /bsd-core/drmP.h
parent31a06d0baca9e378a773ca8bd350860546dd8a79 (diff)
Convert BSD code to mostly use bus_dma, the dma abstraction for dealing
with IOMMUs and such. There is one usage of the forbidden vtophys() left in drm_scatter.c which will be fixed up soon. This required a KPI change for drm_pci_alloc/free() to return/use a drm_dma_handle_t that keeps track of os-specific bits, rather than just passing around the vaddr/busaddr/size. Submitted by: Tonnerre Lombard (partially) Tested on: FreeBSD: Rage128 AGP/PCI Linux: Savage4 AGP/PCI
Diffstat (limited to 'bsd-core/drmP.h')
-rw-r--r--bsd-core/drmP.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index ca28ea2c..6af29718 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -481,14 +481,24 @@ typedef struct drm_freelist {
int high_mark; /* High water mark */
} drm_freelist_t;
+typedef struct drm_dma_handle {
+ void *vaddr;
+ bus_addr_t busaddr;
+#if defined(__FreeBSD__)
+ bus_dma_tag_t tag;
+ bus_dmamap_t map;
+#elif defined(__NetBSD__)
+ bus_dma_segment_t seg;
+#endif
+} drm_dma_handle_t;
+
typedef struct drm_buf_entry {
int buf_size;
int buf_count;
drm_buf_t *buflist;
int seg_count;
+ drm_dma_handle_t **seglist;
int page_order;
- vm_offset_t *seglist;
- dma_addr_t *seglist_bus;
drm_freelist_t freelist;
} drm_buf_entry_t;
@@ -558,9 +568,9 @@ typedef struct drm_agp_head {
typedef struct drm_sg_mem {
unsigned long handle;
- void *virtual;
int pages;
dma_addr_t *busaddr;
+ drm_dma_handle_t *dmah; /* Handle to PCI memory for ATI PCIGART table */
} drm_sg_mem_t;
typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
@@ -579,6 +589,7 @@ typedef struct drm_local_map {
struct resource *bsr;
bus_space_tag_t bst;
bus_space_handle_t bsh;
+ drm_dma_handle_t *dmah;
TAILQ_ENTRY(drm_local_map) link;
} drm_local_map_t;
@@ -910,10 +921,9 @@ int drm_sg_alloc(DRM_IOCTL_ARGS);
int drm_sg_free(DRM_IOCTL_ARGS);
/* consistent PCI memory functions (drm_pci.c) */
-void *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
- dma_addr_t maxaddr, dma_addr_t *busaddr);
-void drm_pci_free(drm_device_t *dev, size_t size, void *vaddr,
- dma_addr_t busaddr);
+drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
+ dma_addr_t maxaddr);
+void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah);
/* Inline replacements for DRM_IOREMAP macros */
static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)