blob: 1d951ab77dce16b8aeadced579268a5369cdb794 [file] [log] [blame]
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
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, sublicense,
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 shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Dave Airlie
25 * Alex Deucher
26 * Jerome Glisse
27 */
28#ifndef __R100D_H__
29#define __R100D_H__
30
31#define CP_PACKET0 0x00000000
32#define PACKET0_BASE_INDEX_SHIFT 0
33#define PACKET0_BASE_INDEX_MASK (0x1ffff << 0)
34#define PACKET0_COUNT_SHIFT 16
35#define PACKET0_COUNT_MASK (0x3fff << 16)
36#define CP_PACKET1 0x40000000
37#define CP_PACKET2 0x80000000
38#define PACKET2_PAD_SHIFT 0
39#define PACKET2_PAD_MASK (0x3fffffff << 0)
40#define CP_PACKET3 0xC0000000
41#define PACKET3_IT_OPCODE_SHIFT 8
42#define PACKET3_IT_OPCODE_MASK (0xff << 8)
43#define PACKET3_COUNT_SHIFT 16
44#define PACKET3_COUNT_MASK (0x3fff << 16)
45/* PACKET3 op code */
46#define PACKET3_NOP 0x10
47#define PACKET3_3D_DRAW_VBUF 0x28
48#define PACKET3_3D_DRAW_IMMD 0x29
49#define PACKET3_3D_DRAW_INDX 0x2A
50#define PACKET3_3D_LOAD_VBPNTR 0x2F
51#define PACKET3_INDX_BUFFER 0x33
52#define PACKET3_3D_DRAW_VBUF_2 0x34
53#define PACKET3_3D_DRAW_IMMD_2 0x35
54#define PACKET3_3D_DRAW_INDX_2 0x36
55#define PACKET3_BITBLT_MULTI 0x9B
56
57#define PACKET0(reg, n) (CP_PACKET0 | \
58 REG_SET(PACKET0_BASE_INDEX, (reg) >> 2) | \
59 REG_SET(PACKET0_COUNT, (n)))
60#define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
61#define PACKET3(op, n) (CP_PACKET3 | \
62 REG_SET(PACKET3_IT_OPCODE, (op)) | \
63 REG_SET(PACKET3_COUNT, (n)))
64
65#define PACKET_TYPE0 0
66#define PACKET_TYPE1 1
67#define PACKET_TYPE2 2
68#define PACKET_TYPE3 3
69
70#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
71#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
72#define CP_PACKET0_GET_REG(h) (((h) & 0x1FFF) << 2)
73#define CP_PACKET0_GET_ONE_REG_WR(h) (((h) >> 15) & 1)
74#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
75
Jerome Glisse45600232009-09-09 22:23:45 +020076/* Registers */
77#define R_000E40_RBBM_STATUS 0x000E40
78#define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0)
79#define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F)
80#define C_000E40_CMDFIFO_AVAIL 0xFFFFFF80
81#define S_000E40_HIRQ_ON_RBB(x) (((x) & 0x1) << 8)
82#define G_000E40_HIRQ_ON_RBB(x) (((x) >> 8) & 0x1)
83#define C_000E40_HIRQ_ON_RBB 0xFFFFFEFF
84#define S_000E40_CPRQ_ON_RBB(x) (((x) & 0x1) << 9)
85#define G_000E40_CPRQ_ON_RBB(x) (((x) >> 9) & 0x1)
86#define C_000E40_CPRQ_ON_RBB 0xFFFFFDFF
87#define S_000E40_CFRQ_ON_RBB(x) (((x) & 0x1) << 10)
88#define G_000E40_CFRQ_ON_RBB(x) (((x) >> 10) & 0x1)
89#define C_000E40_CFRQ_ON_RBB 0xFFFFFBFF
90#define S_000E40_HIRQ_IN_RTBUF(x) (((x) & 0x1) << 11)
91#define G_000E40_HIRQ_IN_RTBUF(x) (((x) >> 11) & 0x1)
92#define C_000E40_HIRQ_IN_RTBUF 0xFFFFF7FF
93#define S_000E40_CPRQ_IN_RTBUF(x) (((x) & 0x1) << 12)
94#define G_000E40_CPRQ_IN_RTBUF(x) (((x) >> 12) & 0x1)
95#define C_000E40_CPRQ_IN_RTBUF 0xFFFFEFFF
96#define S_000E40_CFRQ_IN_RTBUF(x) (((x) & 0x1) << 13)
97#define G_000E40_CFRQ_IN_RTBUF(x) (((x) >> 13) & 0x1)
98#define C_000E40_CFRQ_IN_RTBUF 0xFFFFDFFF
99#define S_000E40_CF_PIPE_BUSY(x) (((x) & 0x1) << 14)
100#define G_000E40_CF_PIPE_BUSY(x) (((x) >> 14) & 0x1)
101#define C_000E40_CF_PIPE_BUSY 0xFFFFBFFF
102#define S_000E40_ENG_EV_BUSY(x) (((x) & 0x1) << 15)
103#define G_000E40_ENG_EV_BUSY(x) (((x) >> 15) & 0x1)
104#define C_000E40_ENG_EV_BUSY 0xFFFF7FFF
105#define S_000E40_CP_CMDSTRM_BUSY(x) (((x) & 0x1) << 16)
106#define G_000E40_CP_CMDSTRM_BUSY(x) (((x) >> 16) & 0x1)
107#define C_000E40_CP_CMDSTRM_BUSY 0xFFFEFFFF
108#define S_000E40_E2_BUSY(x) (((x) & 0x1) << 17)
109#define G_000E40_E2_BUSY(x) (((x) >> 17) & 0x1)
110#define C_000E40_E2_BUSY 0xFFFDFFFF
111#define S_000E40_RB2D_BUSY(x) (((x) & 0x1) << 18)
112#define G_000E40_RB2D_BUSY(x) (((x) >> 18) & 0x1)
113#define C_000E40_RB2D_BUSY 0xFFFBFFFF
114#define S_000E40_RB3D_BUSY(x) (((x) & 0x1) << 19)
115#define G_000E40_RB3D_BUSY(x) (((x) >> 19) & 0x1)
116#define C_000E40_RB3D_BUSY 0xFFF7FFFF
117#define S_000E40_SE_BUSY(x) (((x) & 0x1) << 20)
118#define G_000E40_SE_BUSY(x) (((x) >> 20) & 0x1)
119#define C_000E40_SE_BUSY 0xFFEFFFFF
120#define S_000E40_RE_BUSY(x) (((x) & 0x1) << 21)
121#define G_000E40_RE_BUSY(x) (((x) >> 21) & 0x1)
122#define C_000E40_RE_BUSY 0xFFDFFFFF
123#define S_000E40_TAM_BUSY(x) (((x) & 0x1) << 22)
124#define G_000E40_TAM_BUSY(x) (((x) >> 22) & 0x1)
125#define C_000E40_TAM_BUSY 0xFFBFFFFF
126#define S_000E40_TDM_BUSY(x) (((x) & 0x1) << 23)
127#define G_000E40_TDM_BUSY(x) (((x) >> 23) & 0x1)
128#define C_000E40_TDM_BUSY 0xFF7FFFFF
129#define S_000E40_PB_BUSY(x) (((x) & 0x1) << 24)
130#define G_000E40_PB_BUSY(x) (((x) >> 24) & 0x1)
131#define C_000E40_PB_BUSY 0xFEFFFFFF
132#define S_000E40_GUI_ACTIVE(x) (((x) & 0x1) << 31)
133#define G_000E40_GUI_ACTIVE(x) (((x) >> 31) & 0x1)
134#define C_000E40_GUI_ACTIVE 0x7FFFFFFF
135
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000136#endif