aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/via_dmablit.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2006-01-01 22:26:20 -0500
committerDave Airlie <airlied@linux.ie>2006-01-01 22:26:20 -0500
commit443448d05468277abe99c9b24b9df538dd840f35 (patch)
treebea36178d2ff1e88be9086c95be6c023f9a67f83 /drivers/char/drm/via_dmablit.h
parenta7a2cc315c8a5e51b08538d102ec3229c966ac87 (diff)
drm: via driver update to CVS version
This updates the DRM via driver to the latest CVS version, which contains support for DMA blitting. It also contains some whitespace and other minor fixes From: Thomas Hellstrom <unichrome@shipmail.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/via_dmablit.h')
-rw-r--r--drivers/char/drm/via_dmablit.h138
1 files changed, 138 insertions, 0 deletions
diff --git a/drivers/char/drm/via_dmablit.h b/drivers/char/drm/via_dmablit.h
new file mode 100644
index 000000000000..6486391746b1
--- /dev/null
+++ b/drivers/char/drm/via_dmablit.h
@@ -0,0 +1,138 @@
1/* via_dmablit.h -- PCI DMA BitBlt support for the VIA Unichrome/Pro
2 *
3 * Copyright 2005 Thomas Hellstrom.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sub license,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Authors:
26 * Thomas Hellstrom.
27 * Register info from Digeo Inc.
28 */
29
30#ifndef _VIA_DMABLIT_H
31#define _VIA_DMABLIT_H
32
33#define VIA_NUM_BLIT_ENGINES 2
34#define VIA_NUM_BLIT_SLOTS 8
35
36struct _drm_via_descriptor;
37
38typedef struct _drm_via_sg_info {
39 struct page **pages;
40 unsigned long num_pages;
41 struct _drm_via_descriptor **desc_pages;
42 int num_desc_pages;
43 int num_desc;
44 enum dma_data_direction direction;
45 unsigned char *bounce_buffer;
46 dma_addr_t chain_start;
47 uint32_t free_on_sequence;
48 unsigned int descriptors_per_page;
49 int aborted;
50 enum {
51 dr_via_device_mapped,
52 dr_via_desc_pages_alloc,
53 dr_via_pages_locked,
54 dr_via_pages_alloc,
55 dr_via_sg_init
56 } state;
57} drm_via_sg_info_t;
58
59typedef struct _drm_via_blitq {
60 drm_device_t *dev;
61 uint32_t cur_blit_handle;
62 uint32_t done_blit_handle;
63 unsigned serviced;
64 unsigned head;
65 unsigned cur;
66 unsigned num_free;
67 unsigned num_outstanding;
68 unsigned long end;
69 int aborting;
70 int is_active;
71 drm_via_sg_info_t *blits[VIA_NUM_BLIT_SLOTS];
72 spinlock_t blit_lock;
73 wait_queue_head_t blit_queue[VIA_NUM_BLIT_SLOTS];
74 wait_queue_head_t busy_queue;
75 struct work_struct wq;
76 struct timer_list poll_timer;
77} drm_via_blitq_t;
78
79
80/*
81 * PCI DMA Registers
82 * Channels 2 & 3 don't seem to be implemented in hardware.
83 */
84
85#define VIA_PCI_DMA_MAR0 0xE40 /* Memory Address Register of Channel 0 */
86#define VIA_PCI_DMA_DAR0 0xE44 /* Device Address Register of Channel 0 */
87#define VIA_PCI_DMA_BCR0 0xE48 /* Byte Count Register of Channel 0 */
88#define VIA_PCI_DMA_DPR0 0xE4C /* Descriptor Pointer Register of Channel 0 */
89
90#define VIA_PCI_DMA_MAR1 0xE50 /* Memory Address Register of Channel 1 */
91#define VIA_PCI_DMA_DAR1 0xE54 /* Device Address Register of Channel 1 */
92#define VIA_PCI_DMA_BCR1 0xE58 /* Byte Count Register of Channel 1 */
93#define VIA_PCI_DMA_DPR1 0xE5C /* Descriptor Pointer Register of Channel 1 */
94
95#define VIA_PCI_DMA_MAR2 0xE60 /* Memory Address Register of Channel 2 */
96#define VIA_PCI_DMA_DAR2 0xE64 /* Device Address Register of Channel 2 */
97#define VIA_PCI_DMA_BCR2 0xE68 /* Byte Count Register of Channel 2 */
98#define VIA_PCI_DMA_DPR2 0xE6C /* Descriptor Pointer Register of Channel 2 */
99
100#define VIA_PCI_DMA_MAR3 0xE70 /* Memory Address Register of Channel 3 */
101#define VIA_PCI_DMA_DAR3 0xE74 /* Device Address Register of Channel 3 */
102#define VIA_PCI_DMA_BCR3 0xE78 /* Byte Count Register of Channel 3 */
103#define VIA_PCI_DMA_DPR3 0xE7C /* Descriptor Pointer Register of Channel 3 */
104
105#define VIA_PCI_DMA_MR0 0xE80 /* Mode Register of Channel 0 */
106#define VIA_PCI_DMA_MR1 0xE84 /* Mode Register of Channel 1 */
107#define VIA_PCI_DMA_MR2 0xE88 /* Mode Register of Channel 2 */
108#define VIA_PCI_DMA_MR3 0xE8C /* Mode Register of Channel 3 */
109
110#define VIA_PCI_DMA_CSR0 0xE90 /* Command/Status Register of Channel 0 */
111#define VIA_PCI_DMA_CSR1 0xE94 /* Command/Status Register of Channel 1 */
112#define VIA_PCI_DMA_CSR2 0xE98 /* Command/Status Register of Channel 2 */
113#define VIA_PCI_DMA_CSR3 0xE9C /* Command/Status Register of Channel 3 */
114
115#define VIA_PCI_DMA_PTR 0xEA0 /* Priority Type Register */
116
117/* Define for DMA engine */
118/* DPR */
119#define VIA_DMA_DPR_EC (1<<1) /* end of chain */
120#define VIA_DMA_DPR_DDIE (1<<2) /* descriptor done interrupt enable */
121#define VIA_DMA_DPR_DT (1<<3) /* direction of transfer (RO) */
122
123/* MR */
124#define VIA_DMA_MR_CM (1<<0) /* chaining mode */
125#define VIA_DMA_MR_TDIE (1<<1) /* transfer done interrupt enable */
126#define VIA_DMA_MR_HENDMACMD (1<<7) /* ? */
127
128/* CSR */
129#define VIA_DMA_CSR_DE (1<<0) /* DMA enable */
130#define VIA_DMA_CSR_TS (1<<1) /* transfer start */
131#define VIA_DMA_CSR_TA (1<<2) /* transfer abort */
132#define VIA_DMA_CSR_TD (1<<3) /* transfer done */
133#define VIA_DMA_CSR_DD (1<<4) /* descriptor done */
134#define VIA_DMA_DPR_EC (1<<1) /* end of chain */
135
136
137
138#endif