1254885Sdumbbell/*
2254885Sdumbbell * Copyright 2010 Advanced Micro Devices, Inc.
3254885Sdumbbell *
4254885Sdumbbell * Permission is hereby granted, free of charge, to any person obtaining a
5254885Sdumbbell * copy of this software and associated documentation files (the "Software"),
6254885Sdumbbell * to deal in the Software without restriction, including without limitation
7254885Sdumbbell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8254885Sdumbbell * and/or sell copies of the Software, and to permit persons to whom the
9254885Sdumbbell * Software is furnished to do so, subject to the following conditions:
10254885Sdumbbell *
11254885Sdumbbell * The above copyright notice and this permission notice shall be included in
12254885Sdumbbell * all copies or substantial portions of the Software.
13254885Sdumbbell *
14254885Sdumbbell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15254885Sdumbbell * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16254885Sdumbbell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17254885Sdumbbell * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18254885Sdumbbell * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19254885Sdumbbell * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20254885Sdumbbell * OTHER DEALINGS IN THE SOFTWARE.
21254885Sdumbbell *
22254885Sdumbbell * Authors: Alex Deucher
23254885Sdumbbell */
24254885Sdumbbell
25254885Sdumbbell#include <sys/cdefs.h>
26254885Sdumbbell__FBSDID("$FreeBSD$");
27254885Sdumbbell
28254885Sdumbbell#ifndef __EVERGREEN_REG_H__
29254885Sdumbbell#define __EVERGREEN_REG_H__
30254885Sdumbbell
31254885Sdumbbell/* evergreen */
32254885Sdumbbell#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS               0x310
33254885Sdumbbell#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH          0x324
34254885Sdumbbell#define EVERGREEN_D3VGA_CONTROL                         0x3e0
35254885Sdumbbell#define EVERGREEN_D4VGA_CONTROL                         0x3e4
36254885Sdumbbell#define EVERGREEN_D5VGA_CONTROL                         0x3e8
37254885Sdumbbell#define EVERGREEN_D6VGA_CONTROL                         0x3ec
38254885Sdumbbell
39254885Sdumbbell#define EVERGREEN_P1PLL_SS_CNTL                         0x414
40254885Sdumbbell#define EVERGREEN_P2PLL_SS_CNTL                         0x454
41254885Sdumbbell#       define EVERGREEN_PxPLL_SS_EN                    (1 << 12)
42254885Sdumbbell
43254885Sdumbbell#define EVERGREEN_AUDIO_PLL1_MUL			0x5b0
44254885Sdumbbell#define EVERGREEN_AUDIO_PLL1_DIV			0x5b4
45254885Sdumbbell#define EVERGREEN_AUDIO_PLL1_UNK			0x5bc
46254885Sdumbbell
47254885Sdumbbell#define EVERGREEN_AUDIO_ENABLE				0x5e78
48254885Sdumbbell#define EVERGREEN_AUDIO_VENDOR_ID			0x5ec0
49254885Sdumbbell
50254885Sdumbbell/* GRPH blocks at 0x6800, 0x7400, 0x10000, 0x10c00, 0x11800, 0x12400 */
51254885Sdumbbell#define EVERGREEN_GRPH_ENABLE                           0x6800
52254885Sdumbbell#define EVERGREEN_GRPH_CONTROL                          0x6804
53254885Sdumbbell#       define EVERGREEN_GRPH_DEPTH(x)                  (((x) & 0x3) << 0)
54254885Sdumbbell#       define EVERGREEN_GRPH_DEPTH_8BPP                0
55254885Sdumbbell#       define EVERGREEN_GRPH_DEPTH_16BPP               1
56254885Sdumbbell#       define EVERGREEN_GRPH_DEPTH_32BPP               2
57254885Sdumbbell#       define EVERGREEN_GRPH_NUM_BANKS(x)              (((x) & 0x3) << 2)
58254885Sdumbbell#       define EVERGREEN_ADDR_SURF_2_BANK               0
59254885Sdumbbell#       define EVERGREEN_ADDR_SURF_4_BANK               1
60254885Sdumbbell#       define EVERGREEN_ADDR_SURF_8_BANK               2
61254885Sdumbbell#       define EVERGREEN_ADDR_SURF_16_BANK              3
62254885Sdumbbell#       define EVERGREEN_GRPH_Z(x)                      (((x) & 0x3) << 4)
63254885Sdumbbell#       define EVERGREEN_GRPH_BANK_WIDTH(x)             (((x) & 0x3) << 6)
64254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_WIDTH_1         0
65254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_WIDTH_2         1
66254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_WIDTH_4         2
67254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_WIDTH_8         3
68254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT(x)                 (((x) & 0x7) << 8)
69254885Sdumbbell/* 8 BPP */
70254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_INDEXED            0
71254885Sdumbbell/* 16 BPP */
72254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_ARGB1555           0
73254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_ARGB565            1
74254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_ARGB4444           2
75254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_AI88               3
76254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_MONO16             4
77254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_BGRA5551           5
78254885Sdumbbell/* 32 BPP */
79254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_ARGB8888           0
80254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_ARGB2101010        1
81254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_32BPP_DIG          2
82254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_8B_ARGB2101010     3
83254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_BGRA1010102        4
84254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102     5
85254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_RGB111110          6
86254885Sdumbbell#       define EVERGREEN_GRPH_FORMAT_BGR101111          7
87254885Sdumbbell#       define EVERGREEN_GRPH_BANK_HEIGHT(x)            (((x) & 0x3) << 11)
88254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1        0
89254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2        1
90254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4        2
91254885Sdumbbell#       define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8        3
92254885Sdumbbell#       define EVERGREEN_GRPH_TILE_SPLIT(x)             (((x) & 0x7) << 13)
93254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B       0
94254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B      1
95254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B      2
96254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B      3
97254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB       4
98254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB       5
99254885Sdumbbell#       define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB       6
100254885Sdumbbell#       define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x)      (((x) & 0x3) << 18)
101254885Sdumbbell#       define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1  0
102254885Sdumbbell#       define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2  1
103254885Sdumbbell#       define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4  2
104254885Sdumbbell#       define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8  3
105254885Sdumbbell#       define EVERGREEN_GRPH_ARRAY_MODE(x)             (((x) & 0x7) << 20)
106254885Sdumbbell#       define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL      0
107254885Sdumbbell#       define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED      1
108254885Sdumbbell#       define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1      2
109254885Sdumbbell#       define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1      4
110254885Sdumbbell#define EVERGREEN_GRPH_SWAP_CONTROL                     0x680c
111254885Sdumbbell#       define EVERGREEN_GRPH_ENDIAN_SWAP(x)            (((x) & 0x3) << 0)
112254885Sdumbbell#       define EVERGREEN_GRPH_ENDIAN_NONE               0
113254885Sdumbbell#       define EVERGREEN_GRPH_ENDIAN_8IN16              1
114254885Sdumbbell#       define EVERGREEN_GRPH_ENDIAN_8IN32              2
115254885Sdumbbell#       define EVERGREEN_GRPH_ENDIAN_8IN64              3
116254885Sdumbbell#       define EVERGREEN_GRPH_RED_CROSSBAR(x)           (((x) & 0x3) << 4)
117254885Sdumbbell#       define EVERGREEN_GRPH_RED_SEL_R                 0
118254885Sdumbbell#       define EVERGREEN_GRPH_RED_SEL_G                 1
119254885Sdumbbell#       define EVERGREEN_GRPH_RED_SEL_B                 2
120254885Sdumbbell#       define EVERGREEN_GRPH_RED_SEL_A                 3
121254885Sdumbbell#       define EVERGREEN_GRPH_GREEN_CROSSBAR(x)         (((x) & 0x3) << 6)
122254885Sdumbbell#       define EVERGREEN_GRPH_GREEN_SEL_G               0
123254885Sdumbbell#       define EVERGREEN_GRPH_GREEN_SEL_B               1
124254885Sdumbbell#       define EVERGREEN_GRPH_GREEN_SEL_A               2
125254885Sdumbbell#       define EVERGREEN_GRPH_GREEN_SEL_R               3
126254885Sdumbbell#       define EVERGREEN_GRPH_BLUE_CROSSBAR(x)          (((x) & 0x3) << 8)
127254885Sdumbbell#       define EVERGREEN_GRPH_BLUE_SEL_B                0
128254885Sdumbbell#       define EVERGREEN_GRPH_BLUE_SEL_A                1
129254885Sdumbbell#       define EVERGREEN_GRPH_BLUE_SEL_R                2
130254885Sdumbbell#       define EVERGREEN_GRPH_BLUE_SEL_G                3
131254885Sdumbbell#       define EVERGREEN_GRPH_ALPHA_CROSSBAR(x)         (((x) & 0x3) << 10)
132254885Sdumbbell#       define EVERGREEN_GRPH_ALPHA_SEL_A               0
133254885Sdumbbell#       define EVERGREEN_GRPH_ALPHA_SEL_R               1
134254885Sdumbbell#       define EVERGREEN_GRPH_ALPHA_SEL_G               2
135254885Sdumbbell#       define EVERGREEN_GRPH_ALPHA_SEL_B               3
136254885Sdumbbell#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS          0x6810
137254885Sdumbbell#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS        0x6814
138254885Sdumbbell#       define EVERGREEN_GRPH_DFQ_ENABLE                (1 << 0)
139254885Sdumbbell#       define EVERGREEN_GRPH_SURFACE_ADDRESS_MASK      0xffffff00
140254885Sdumbbell#define EVERGREEN_GRPH_PITCH                            0x6818
141254885Sdumbbell#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH     0x681c
142254885Sdumbbell#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH   0x6820
143254885Sdumbbell#define EVERGREEN_GRPH_SURFACE_OFFSET_X                 0x6824
144254885Sdumbbell#define EVERGREEN_GRPH_SURFACE_OFFSET_Y                 0x6828
145254885Sdumbbell#define EVERGREEN_GRPH_X_START                          0x682c
146254885Sdumbbell#define EVERGREEN_GRPH_Y_START                          0x6830
147254885Sdumbbell#define EVERGREEN_GRPH_X_END                            0x6834
148254885Sdumbbell#define EVERGREEN_GRPH_Y_END                            0x6838
149254885Sdumbbell#define EVERGREEN_GRPH_UPDATE                           0x6844
150254885Sdumbbell#       define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING    (1 << 2)
151254885Sdumbbell#       define EVERGREEN_GRPH_UPDATE_LOCK               (1 << 16)
152254885Sdumbbell#define EVERGREEN_GRPH_FLIP_CONTROL                     0x6848
153254885Sdumbbell#       define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0)
154254885Sdumbbell
155254885Sdumbbell/* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
156254885Sdumbbell#define EVERGREEN_CUR_CONTROL                           0x6998
157254885Sdumbbell#       define EVERGREEN_CURSOR_EN                      (1 << 0)
158254885Sdumbbell#       define EVERGREEN_CURSOR_MODE(x)                 (((x) & 0x3) << 8)
159254885Sdumbbell#       define EVERGREEN_CURSOR_MONO                    0
160254885Sdumbbell#       define EVERGREEN_CURSOR_24_1                    1
161254885Sdumbbell#       define EVERGREEN_CURSOR_24_8_PRE_MULT           2
162254885Sdumbbell#       define EVERGREEN_CURSOR_24_8_UNPRE_MULT         3
163254885Sdumbbell#       define EVERGREEN_CURSOR_2X_MAGNIFY              (1 << 16)
164254885Sdumbbell#       define EVERGREEN_CURSOR_FORCE_MC_ON             (1 << 20)
165254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_CONTROL(x)       (((x) & 0x7) << 24)
166254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_ALWAYS           0
167254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_1_8              1
168254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_1_4              2
169254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_3_8              3
170254885Sdumbbell#       define EVERGREEN_CURSOR_URGENT_1_2              4
171254885Sdumbbell#define EVERGREEN_CUR_SURFACE_ADDRESS                   0x699c
172254885Sdumbbell#       define EVERGREEN_CUR_SURFACE_ADDRESS_MASK       0xfffff000
173254885Sdumbbell#define EVERGREEN_CUR_SIZE                              0x69a0
174254885Sdumbbell#define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH              0x69a4
175254885Sdumbbell#define EVERGREEN_CUR_POSITION                          0x69a8
176254885Sdumbbell#define EVERGREEN_CUR_HOT_SPOT                          0x69ac
177254885Sdumbbell#define EVERGREEN_CUR_COLOR1                            0x69b0
178254885Sdumbbell#define EVERGREEN_CUR_COLOR2                            0x69b4
179254885Sdumbbell#define EVERGREEN_CUR_UPDATE                            0x69b8
180254885Sdumbbell#       define EVERGREEN_CURSOR_UPDATE_PENDING          (1 << 0)
181254885Sdumbbell#       define EVERGREEN_CURSOR_UPDATE_TAKEN            (1 << 1)
182254885Sdumbbell#       define EVERGREEN_CURSOR_UPDATE_LOCK             (1 << 16)
183254885Sdumbbell#       define EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
184254885Sdumbbell
185254885Sdumbbell/* LUT blocks at 0x69e0, 0x75e0, 0x101e0, 0x10de0, 0x119e0, 0x125e0 */
186254885Sdumbbell#define EVERGREEN_DC_LUT_RW_MODE                        0x69e0
187254885Sdumbbell#define EVERGREEN_DC_LUT_RW_INDEX                       0x69e4
188254885Sdumbbell#define EVERGREEN_DC_LUT_SEQ_COLOR                      0x69e8
189254885Sdumbbell#define EVERGREEN_DC_LUT_PWL_DATA                       0x69ec
190254885Sdumbbell#define EVERGREEN_DC_LUT_30_COLOR                       0x69f0
191254885Sdumbbell#define EVERGREEN_DC_LUT_VGA_ACCESS_ENABLE              0x69f4
192254885Sdumbbell#define EVERGREEN_DC_LUT_WRITE_EN_MASK                  0x69f8
193254885Sdumbbell#define EVERGREEN_DC_LUT_AUTOFILL                       0x69fc
194254885Sdumbbell#define EVERGREEN_DC_LUT_CONTROL                        0x6a00
195254885Sdumbbell#define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE              0x6a04
196254885Sdumbbell#define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN             0x6a08
197254885Sdumbbell#define EVERGREEN_DC_LUT_BLACK_OFFSET_RED               0x6a0c
198254885Sdumbbell#define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE              0x6a10
199254885Sdumbbell#define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN             0x6a14
200254885Sdumbbell#define EVERGREEN_DC_LUT_WHITE_OFFSET_RED               0x6a18
201254885Sdumbbell
202254885Sdumbbell#define EVERGREEN_DATA_FORMAT                           0x6b00
203254885Sdumbbell#       define EVERGREEN_INTERLEAVE_EN                  (1 << 0)
204254885Sdumbbell#define EVERGREEN_DESKTOP_HEIGHT                        0x6b04
205254885Sdumbbell#define EVERGREEN_VLINE_START_END                       0x6b08
206254885Sdumbbell#define EVERGREEN_VLINE_STATUS                          0x6bb8
207254885Sdumbbell#       define EVERGREEN_VLINE_STAT                     (1 << 12)
208254885Sdumbbell
209254885Sdumbbell#define EVERGREEN_VIEWPORT_START                        0x6d70
210254885Sdumbbell#define EVERGREEN_VIEWPORT_SIZE                         0x6d74
211254885Sdumbbell
212254885Sdumbbell/* display controller offsets used for crtc/cur/lut/grph/viewport/etc. */
213254885Sdumbbell#define EVERGREEN_CRTC0_REGISTER_OFFSET                 (0x6df0 - 0x6df0)
214254885Sdumbbell#define EVERGREEN_CRTC1_REGISTER_OFFSET                 (0x79f0 - 0x6df0)
215254885Sdumbbell#define EVERGREEN_CRTC2_REGISTER_OFFSET                 (0x105f0 - 0x6df0)
216254885Sdumbbell#define EVERGREEN_CRTC3_REGISTER_OFFSET                 (0x111f0 - 0x6df0)
217254885Sdumbbell#define EVERGREEN_CRTC4_REGISTER_OFFSET                 (0x11df0 - 0x6df0)
218254885Sdumbbell#define EVERGREEN_CRTC5_REGISTER_OFFSET                 (0x129f0 - 0x6df0)
219254885Sdumbbell
220254885Sdumbbell/* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
221254885Sdumbbell#define EVERGREEN_CRTC_V_BLANK_START_END                0x6e34
222254885Sdumbbell#define EVERGREEN_CRTC_CONTROL                          0x6e70
223254885Sdumbbell#       define EVERGREEN_CRTC_MASTER_EN                 (1 << 0)
224254885Sdumbbell#       define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
225254885Sdumbbell#define EVERGREEN_CRTC_BLANK_CONTROL                    0x6e74
226254885Sdumbbell#       define EVERGREEN_CRTC_BLANK_DATA_EN             (1 << 8)
227254885Sdumbbell#define EVERGREEN_CRTC_STATUS                           0x6e8c
228254885Sdumbbell#       define EVERGREEN_CRTC_V_BLANK                   (1 << 0)
229254885Sdumbbell#define EVERGREEN_CRTC_STATUS_POSITION                  0x6e90
230254885Sdumbbell#define EVERGREEN_MASTER_UPDATE_MODE                    0x6ef8
231254885Sdumbbell#define EVERGREEN_CRTC_UPDATE_LOCK                      0x6ed4
232254885Sdumbbell
233254885Sdumbbell#define EVERGREEN_DC_GPIO_HPD_MASK                      0x64b0
234254885Sdumbbell#define EVERGREEN_DC_GPIO_HPD_A                         0x64b4
235254885Sdumbbell#define EVERGREEN_DC_GPIO_HPD_EN                        0x64b8
236254885Sdumbbell#define EVERGREEN_DC_GPIO_HPD_Y                         0x64bc
237254885Sdumbbell
238254885Sdumbbell/* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */
239254885Sdumbbell#define EVERGREEN_HDMI_BASE				0x7030
240254885Sdumbbell
241254885Sdumbbell#endif
242