2 * Copyright (C) 2007 Ben Skeggs.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef __NOUVEAU_DMA_H__
28 #define __NOUVEAU_DMA_H__
32 } nouveau_subchannel_id_t
;
38 NvNotify0
= 0x8003d003
39 } nouveau_object_handle_t
;
41 #define NV_MEMORY_TO_MEMORY_FORMAT 0x00000039
42 #define NV_MEMORY_TO_MEMORY_FORMAT_NAME 0x00000000
43 #define NV_MEMORY_TO_MEMORY_FORMAT_SET_REF 0x00000050
44 #define NV_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
45 #define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104
46 #define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY_STYLE_WRITE 0x00000000
47 #define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY_STYLE_WRITE_LE_AWAKEN 0x00000001
48 #define NV_MEMORY_TO_MEMORY_FORMAT_SET_DMA_NOTIFY 0x00000180
49 #define NV_MEMORY_TO_MEMORY_FORMAT_SET_DMA_SOURCE 0x00000184
50 #define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c
52 #define NV50_MEMORY_TO_MEMORY_FORMAT 0x00005039
53 #define NV50_MEMORY_TO_MEMORY_FORMAT_UNK200 0x00000200
54 #define NV50_MEMORY_TO_MEMORY_FORMAT_UNK21C 0x0000021c
55 #define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x00000238
56 #define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x0000023c
58 #define BEGIN_RING(subc, mthd, cnt) do { \
59 int push_size = (cnt) + 1; \
60 if (dchan->push_free) { \
61 DRM_ERROR("prior packet incomplete: %d\n", dchan->push_free); \
64 if (dchan->free < push_size) { \
65 if (nouveau_dma_wait(dev, push_size)) { \
66 DRM_ERROR("FIFO timeout\n"); \
70 dchan->free -= push_size; \
71 dchan->push_free = push_size; \
72 OUT_RING(((cnt)<<18) | ((subc)<<15) | mthd); \
75 #define OUT_RING(data) do { \
76 if (dchan->push_free == 0) { \
77 DRM_ERROR("no space left in packet\n"); \
80 dchan->pushbuf[dchan->cur++] = (data); \
84 #define FIRE_RING() do { \
85 if (dchan->push_free) { \
86 DRM_ERROR("packet incomplete: %d\n", dchan->push_free); \
89 if (dchan->cur != dchan->put) { \
90 DRM_MEMORYBARRIER(); \
91 dchan->put = dchan->cur; \
92 NV_WRITE(dchan->chan->put, dchan->put << 2); \