blob: 4eaa5f1209b2833436b9c60031b5dc7c45b75499 [file] [log] [blame]
Daniel Vetter0a10c852010-03-11 21:19:14 +00001/*
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
29#include <linux/console.h>
30#include <drm/drmP.h>
31#include <drm/drm_crtc_helper.h>
32#include <drm/radeon_drm.h>
33#include <linux/vgaarb.h>
34#include <linux/vga_switcheroo.h>
35#include "radeon_reg.h"
36#include "radeon.h"
37#include "radeon_asic.h"
38#include "atom.h"
39
40/*
41 * Registers accessors functions.
42 */
43static uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg)
44{
45 DRM_ERROR("Invalid callback to read register 0x%04X\n", reg);
46 BUG_ON(1);
47 return 0;
48}
49
50static void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
51{
52 DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n",
53 reg, v);
54 BUG_ON(1);
55}
56
57static void radeon_register_accessor_init(struct radeon_device *rdev)
58{
59 rdev->mc_rreg = &radeon_invalid_rreg;
60 rdev->mc_wreg = &radeon_invalid_wreg;
61 rdev->pll_rreg = &radeon_invalid_rreg;
62 rdev->pll_wreg = &radeon_invalid_wreg;
63 rdev->pciep_rreg = &radeon_invalid_rreg;
64 rdev->pciep_wreg = &radeon_invalid_wreg;
65
66 /* Don't change order as we are overridding accessor. */
67 if (rdev->family < CHIP_RV515) {
68 rdev->pcie_reg_mask = 0xff;
69 } else {
70 rdev->pcie_reg_mask = 0x7ff;
71 }
72 /* FIXME: not sure here */
73 if (rdev->family <= CHIP_R580) {
74 rdev->pll_rreg = &r100_pll_rreg;
75 rdev->pll_wreg = &r100_pll_wreg;
76 }
77 if (rdev->family >= CHIP_R420) {
78 rdev->mc_rreg = &r420_mc_rreg;
79 rdev->mc_wreg = &r420_mc_wreg;
80 }
81 if (rdev->family >= CHIP_RV515) {
82 rdev->mc_rreg = &rv515_mc_rreg;
83 rdev->mc_wreg = &rv515_mc_wreg;
84 }
85 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {
86 rdev->mc_rreg = &rs400_mc_rreg;
87 rdev->mc_wreg = &rs400_mc_wreg;
88 }
89 if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) {
90 rdev->mc_rreg = &rs690_mc_rreg;
91 rdev->mc_wreg = &rs690_mc_wreg;
92 }
93 if (rdev->family == CHIP_RS600) {
94 rdev->mc_rreg = &rs600_mc_rreg;
95 rdev->mc_wreg = &rs600_mc_wreg;
96 }
Alex Deucherb4df8be2011-04-12 13:40:18 -040097 if (rdev->family >= CHIP_R600) {
Daniel Vetter0a10c852010-03-11 21:19:14 +000098 rdev->pciep_rreg = &r600_pciep_rreg;
99 rdev->pciep_wreg = &r600_pciep_wreg;
100 }
101}
102
103
104/* helper to disable agp */
105void radeon_agp_disable(struct radeon_device *rdev)
106{
107 rdev->flags &= ~RADEON_IS_AGP;
108 if (rdev->family >= CHIP_R600) {
109 DRM_INFO("Forcing AGP to PCIE mode\n");
110 rdev->flags |= RADEON_IS_PCIE;
111 } else if (rdev->family >= CHIP_RV515 ||
112 rdev->family == CHIP_RV380 ||
113 rdev->family == CHIP_RV410 ||
114 rdev->family == CHIP_R423) {
115 DRM_INFO("Forcing AGP to PCIE mode\n");
116 rdev->flags |= RADEON_IS_PCIE;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500117 rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
118 rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
Daniel Vetter0a10c852010-03-11 21:19:14 +0000119 } else {
120 DRM_INFO("Forcing AGP to PCI mode\n");
121 rdev->flags |= RADEON_IS_PCI;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500122 rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
123 rdev->asic->gart.set_page = &r100_pci_gart_set_page;
Daniel Vetter0a10c852010-03-11 21:19:14 +0000124 }
125 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
126}
127
128/*
129 * ASIC
130 */
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000131static struct radeon_asic r100_asic = {
132 .init = &r100_init,
133 .fini = &r100_fini,
134 .suspend = &r100_suspend,
135 .resume = &r100_resume,
136 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000137 .gpu_is_lockup = &r100_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000138 .asic_reset = &r100_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500139 .gart = {
140 .tlb_flush = &r100_pci_gart_tlb_flush,
141 .set_page = &r100_pci_gart_set_page,
142 },
Christian König4c87bc22011-10-19 19:02:21 +0200143 .ring = {
144 [RADEON_RING_TYPE_GFX_INDEX] = {
145 .ib_execute = &r100_ring_ib_execute,
146 .emit_fence = &r100_fence_ring_emit,
147 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100148 .cs_parse = &r100_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500149 .ring_start = &r100_ring_start,
150 .ring_test = &r100_ring_test,
151 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200152 }
153 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500154 .irq = {
155 .set = &r100_irq_set,
156 .process = &r100_irq_process,
157 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500158 .display = {
159 .bandwidth_update = &r100_bandwidth_update,
160 .get_vblank_counter = &r100_get_vblank_counter,
161 .wait_for_vblank = &r100_wait_for_vblank,
162 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500163 .copy = {
164 .blit = &r100_copy_blit,
165 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
166 .dma = NULL,
167 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
168 .copy = &r100_copy_blit,
169 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
170 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000171 .set_surface_reg = r100_set_surface_reg,
172 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500173 .hpd = {
174 .init = &r100_hpd_init,
175 .fini = &r100_hpd_fini,
176 .sense = &r100_hpd_sense,
177 .set_polarity = &r100_hpd_set_polarity,
178 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000179 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400180 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500181 .pm = {
182 .misc = &r100_pm_misc,
183 .prepare = &r100_pm_prepare,
184 .finish = &r100_pm_finish,
185 .init_profile = &r100_pm_init_profile,
186 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500187 .get_engine_clock = &radeon_legacy_get_engine_clock,
188 .set_engine_clock = &radeon_legacy_set_engine_clock,
189 .get_memory_clock = &radeon_legacy_get_memory_clock,
190 .set_memory_clock = NULL,
191 .get_pcie_lanes = NULL,
192 .set_pcie_lanes = NULL,
193 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500194 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500195 .pflip = {
196 .pre_page_flip = &r100_pre_page_flip,
197 .page_flip = &r100_page_flip,
198 .post_page_flip = &r100_post_page_flip,
199 },
Alex Deucher89e51812012-02-23 17:53:38 -0500200 .mc_wait_for_idle = &r100_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000201};
202
203static struct radeon_asic r200_asic = {
204 .init = &r100_init,
205 .fini = &r100_fini,
206 .suspend = &r100_suspend,
207 .resume = &r100_resume,
208 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000209 .gpu_is_lockup = &r100_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000210 .asic_reset = &r100_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500211 .gart = {
212 .tlb_flush = &r100_pci_gart_tlb_flush,
213 .set_page = &r100_pci_gart_set_page,
214 },
Christian König4c87bc22011-10-19 19:02:21 +0200215 .ring = {
216 [RADEON_RING_TYPE_GFX_INDEX] = {
217 .ib_execute = &r100_ring_ib_execute,
218 .emit_fence = &r100_fence_ring_emit,
219 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100220 .cs_parse = &r100_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500221 .ring_start = &r100_ring_start,
222 .ring_test = &r100_ring_test,
223 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200224 }
225 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500226 .irq = {
227 .set = &r100_irq_set,
228 .process = &r100_irq_process,
229 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500230 .display = {
231 .bandwidth_update = &r100_bandwidth_update,
232 .get_vblank_counter = &r100_get_vblank_counter,
233 .wait_for_vblank = &r100_wait_for_vblank,
234 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500235 .copy = {
236 .blit = &r100_copy_blit,
237 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
238 .dma = &r200_copy_dma,
239 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
240 .copy = &r100_copy_blit,
241 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
242 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000243 .set_surface_reg = r100_set_surface_reg,
244 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500245 .hpd = {
246 .init = &r100_hpd_init,
247 .fini = &r100_hpd_fini,
248 .sense = &r100_hpd_sense,
249 .set_polarity = &r100_hpd_set_polarity,
250 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000251 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400252 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500253 .pm = {
254 .misc = &r100_pm_misc,
255 .prepare = &r100_pm_prepare,
256 .finish = &r100_pm_finish,
257 .init_profile = &r100_pm_init_profile,
258 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500259 .get_engine_clock = &radeon_legacy_get_engine_clock,
260 .set_engine_clock = &radeon_legacy_set_engine_clock,
261 .get_memory_clock = &radeon_legacy_get_memory_clock,
262 .set_memory_clock = NULL,
263 .get_pcie_lanes = NULL,
264 .set_pcie_lanes = NULL,
265 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500266 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500267 .pflip = {
268 .pre_page_flip = &r100_pre_page_flip,
269 .page_flip = &r100_page_flip,
270 .post_page_flip = &r100_post_page_flip,
271 },
Alex Deucher89e51812012-02-23 17:53:38 -0500272 .mc_wait_for_idle = &r100_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000273};
274
275static struct radeon_asic r300_asic = {
276 .init = &r300_init,
277 .fini = &r300_fini,
278 .suspend = &r300_suspend,
279 .resume = &r300_resume,
280 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000281 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000282 .asic_reset = &r300_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500283 .gart = {
284 .tlb_flush = &r100_pci_gart_tlb_flush,
285 .set_page = &r100_pci_gart_set_page,
286 },
Christian König4c87bc22011-10-19 19:02:21 +0200287 .ring = {
288 [RADEON_RING_TYPE_GFX_INDEX] = {
289 .ib_execute = &r100_ring_ib_execute,
290 .emit_fence = &r300_fence_ring_emit,
291 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100292 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500293 .ring_start = &r300_ring_start,
294 .ring_test = &r100_ring_test,
295 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200296 }
297 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500298 .irq = {
299 .set = &r100_irq_set,
300 .process = &r100_irq_process,
301 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500302 .display = {
303 .bandwidth_update = &r100_bandwidth_update,
304 .get_vblank_counter = &r100_get_vblank_counter,
305 .wait_for_vblank = &r100_wait_for_vblank,
306 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500307 .copy = {
308 .blit = &r100_copy_blit,
309 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
310 .dma = &r200_copy_dma,
311 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
312 .copy = &r100_copy_blit,
313 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
314 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000315 .set_surface_reg = r100_set_surface_reg,
316 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500317 .hpd = {
318 .init = &r100_hpd_init,
319 .fini = &r100_hpd_fini,
320 .sense = &r100_hpd_sense,
321 .set_polarity = &r100_hpd_set_polarity,
322 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000323 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400324 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500325 .pm = {
326 .misc = &r100_pm_misc,
327 .prepare = &r100_pm_prepare,
328 .finish = &r100_pm_finish,
329 .init_profile = &r100_pm_init_profile,
330 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500331 .get_engine_clock = &radeon_legacy_get_engine_clock,
332 .set_engine_clock = &radeon_legacy_set_engine_clock,
333 .get_memory_clock = &radeon_legacy_get_memory_clock,
334 .set_memory_clock = NULL,
335 .get_pcie_lanes = &rv370_get_pcie_lanes,
336 .set_pcie_lanes = &rv370_set_pcie_lanes,
337 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500338 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500339 .pflip = {
340 .pre_page_flip = &r100_pre_page_flip,
341 .page_flip = &r100_page_flip,
342 .post_page_flip = &r100_post_page_flip,
343 },
Alex Deucher89e51812012-02-23 17:53:38 -0500344 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000345};
346
347static struct radeon_asic r300_asic_pcie = {
348 .init = &r300_init,
349 .fini = &r300_fini,
350 .suspend = &r300_suspend,
351 .resume = &r300_resume,
352 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000353 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000354 .asic_reset = &r300_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500355 .gart = {
356 .tlb_flush = &rv370_pcie_gart_tlb_flush,
357 .set_page = &rv370_pcie_gart_set_page,
358 },
Christian König4c87bc22011-10-19 19:02:21 +0200359 .ring = {
360 [RADEON_RING_TYPE_GFX_INDEX] = {
361 .ib_execute = &r100_ring_ib_execute,
362 .emit_fence = &r300_fence_ring_emit,
363 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100364 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500365 .ring_start = &r300_ring_start,
366 .ring_test = &r100_ring_test,
367 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200368 }
369 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500370 .irq = {
371 .set = &r100_irq_set,
372 .process = &r100_irq_process,
373 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500374 .display = {
375 .bandwidth_update = &r100_bandwidth_update,
376 .get_vblank_counter = &r100_get_vblank_counter,
377 .wait_for_vblank = &r100_wait_for_vblank,
378 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500379 .copy = {
380 .blit = &r100_copy_blit,
381 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
382 .dma = &r200_copy_dma,
383 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
384 .copy = &r100_copy_blit,
385 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
386 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000387 .set_surface_reg = r100_set_surface_reg,
388 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500389 .hpd = {
390 .init = &r100_hpd_init,
391 .fini = &r100_hpd_fini,
392 .sense = &r100_hpd_sense,
393 .set_polarity = &r100_hpd_set_polarity,
394 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000395 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400396 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500397 .pm = {
398 .misc = &r100_pm_misc,
399 .prepare = &r100_pm_prepare,
400 .finish = &r100_pm_finish,
401 .init_profile = &r100_pm_init_profile,
402 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500403 .get_engine_clock = &radeon_legacy_get_engine_clock,
404 .set_engine_clock = &radeon_legacy_set_engine_clock,
405 .get_memory_clock = &radeon_legacy_get_memory_clock,
406 .set_memory_clock = NULL,
407 .get_pcie_lanes = &rv370_get_pcie_lanes,
408 .set_pcie_lanes = &rv370_set_pcie_lanes,
409 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500410 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500411 .pflip = {
412 .pre_page_flip = &r100_pre_page_flip,
413 .page_flip = &r100_page_flip,
414 .post_page_flip = &r100_post_page_flip,
415 },
Alex Deucher89e51812012-02-23 17:53:38 -0500416 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000417};
418
419static struct radeon_asic r420_asic = {
420 .init = &r420_init,
421 .fini = &r420_fini,
422 .suspend = &r420_suspend,
423 .resume = &r420_resume,
424 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000425 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000426 .asic_reset = &r300_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500427 .gart = {
428 .tlb_flush = &rv370_pcie_gart_tlb_flush,
429 .set_page = &rv370_pcie_gart_set_page,
430 },
Christian König4c87bc22011-10-19 19:02:21 +0200431 .ring = {
432 [RADEON_RING_TYPE_GFX_INDEX] = {
433 .ib_execute = &r100_ring_ib_execute,
434 .emit_fence = &r300_fence_ring_emit,
435 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100436 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500437 .ring_start = &r300_ring_start,
438 .ring_test = &r100_ring_test,
439 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200440 }
441 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500442 .irq = {
443 .set = &r100_irq_set,
444 .process = &r100_irq_process,
445 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500446 .display = {
447 .bandwidth_update = &r100_bandwidth_update,
448 .get_vblank_counter = &r100_get_vblank_counter,
449 .wait_for_vblank = &r100_wait_for_vblank,
450 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500451 .copy = {
452 .blit = &r100_copy_blit,
453 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
454 .dma = &r200_copy_dma,
455 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
456 .copy = &r100_copy_blit,
457 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
458 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000459 .set_surface_reg = r100_set_surface_reg,
460 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500461
Alex Deucher901ea572012-02-23 17:53:39 -0500462 .hpd = {
463 .init = &r100_hpd_init,
464 .fini = &r100_hpd_fini,
465 .sense = &r100_hpd_sense,
466 .set_polarity = &r100_hpd_set_polarity,
467 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000468 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400469 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500470 .pm = {
471 .misc = &r100_pm_misc,
472 .prepare = &r100_pm_prepare,
473 .finish = &r100_pm_finish,
474 .init_profile = &r420_pm_init_profile,
475 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500476 .get_engine_clock = &radeon_atom_get_engine_clock,
477 .set_engine_clock = &radeon_atom_set_engine_clock,
478 .get_memory_clock = &radeon_atom_get_memory_clock,
479 .set_memory_clock = &radeon_atom_set_memory_clock,
480 .get_pcie_lanes = &rv370_get_pcie_lanes,
481 .set_pcie_lanes = &rv370_set_pcie_lanes,
482 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500483 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500484 .pflip = {
485 .pre_page_flip = &r100_pre_page_flip,
486 .page_flip = &r100_page_flip,
487 .post_page_flip = &r100_post_page_flip,
488 },
Alex Deucher89e51812012-02-23 17:53:38 -0500489 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000490};
491
492static struct radeon_asic rs400_asic = {
493 .init = &rs400_init,
494 .fini = &rs400_fini,
495 .suspend = &rs400_suspend,
496 .resume = &rs400_resume,
497 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000498 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000499 .asic_reset = &r300_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500500 .gart = {
501 .tlb_flush = &rs400_gart_tlb_flush,
502 .set_page = &rs400_gart_set_page,
503 },
Christian König4c87bc22011-10-19 19:02:21 +0200504 .ring = {
505 [RADEON_RING_TYPE_GFX_INDEX] = {
506 .ib_execute = &r100_ring_ib_execute,
507 .emit_fence = &r300_fence_ring_emit,
508 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100509 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500510 .ring_start = &r300_ring_start,
511 .ring_test = &r100_ring_test,
512 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200513 }
514 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500515 .irq = {
516 .set = &r100_irq_set,
517 .process = &r100_irq_process,
518 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500519 .display = {
520 .bandwidth_update = &r100_bandwidth_update,
521 .get_vblank_counter = &r100_get_vblank_counter,
522 .wait_for_vblank = &r100_wait_for_vblank,
523 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500524 .copy = {
525 .blit = &r100_copy_blit,
526 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
527 .dma = &r200_copy_dma,
528 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
529 .copy = &r100_copy_blit,
530 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
531 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000532 .set_surface_reg = r100_set_surface_reg,
533 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500534 .hpd = {
535 .init = &r100_hpd_init,
536 .fini = &r100_hpd_fini,
537 .sense = &r100_hpd_sense,
538 .set_polarity = &r100_hpd_set_polarity,
539 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000540 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400541 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500542 .pm = {
543 .misc = &r100_pm_misc,
544 .prepare = &r100_pm_prepare,
545 .finish = &r100_pm_finish,
546 .init_profile = &r100_pm_init_profile,
547 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500548 .get_engine_clock = &radeon_legacy_get_engine_clock,
549 .set_engine_clock = &radeon_legacy_set_engine_clock,
550 .get_memory_clock = &radeon_legacy_get_memory_clock,
551 .set_memory_clock = NULL,
552 .get_pcie_lanes = NULL,
553 .set_pcie_lanes = NULL,
554 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500555 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500556 .pflip = {
557 .pre_page_flip = &r100_pre_page_flip,
558 .page_flip = &r100_page_flip,
559 .post_page_flip = &r100_post_page_flip,
560 },
Alex Deucher89e51812012-02-23 17:53:38 -0500561 .mc_wait_for_idle = &rs400_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000562};
563
564static struct radeon_asic rs600_asic = {
565 .init = &rs600_init,
566 .fini = &rs600_fini,
567 .suspend = &rs600_suspend,
568 .resume = &rs600_resume,
569 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000570 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000571 .asic_reset = &rs600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500572 .gart = {
573 .tlb_flush = &rs600_gart_tlb_flush,
574 .set_page = &rs600_gart_set_page,
575 },
Christian König4c87bc22011-10-19 19:02:21 +0200576 .ring = {
577 [RADEON_RING_TYPE_GFX_INDEX] = {
578 .ib_execute = &r100_ring_ib_execute,
579 .emit_fence = &r300_fence_ring_emit,
580 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100581 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500582 .ring_start = &r300_ring_start,
583 .ring_test = &r100_ring_test,
584 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200585 }
586 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500587 .irq = {
588 .set = &rs600_irq_set,
589 .process = &rs600_irq_process,
590 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500591 .display = {
592 .bandwidth_update = &rs600_bandwidth_update,
593 .get_vblank_counter = &rs600_get_vblank_counter,
594 .wait_for_vblank = &avivo_wait_for_vblank,
595 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500596 .copy = {
597 .blit = &r100_copy_blit,
598 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
599 .dma = &r200_copy_dma,
600 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
601 .copy = &r100_copy_blit,
602 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
603 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000604 .set_surface_reg = r100_set_surface_reg,
605 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500606 .hpd = {
607 .init = &rs600_hpd_init,
608 .fini = &rs600_hpd_fini,
609 .sense = &rs600_hpd_sense,
610 .set_polarity = &rs600_hpd_set_polarity,
611 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000612 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400613 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500614 .pm = {
615 .misc = &rs600_pm_misc,
616 .prepare = &rs600_pm_prepare,
617 .finish = &rs600_pm_finish,
618 .init_profile = &r420_pm_init_profile,
619 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500620 .get_engine_clock = &radeon_atom_get_engine_clock,
621 .set_engine_clock = &radeon_atom_set_engine_clock,
622 .get_memory_clock = &radeon_atom_get_memory_clock,
623 .set_memory_clock = &radeon_atom_set_memory_clock,
624 .get_pcie_lanes = NULL,
625 .set_pcie_lanes = NULL,
626 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500627 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500628 .pflip = {
629 .pre_page_flip = &rs600_pre_page_flip,
630 .page_flip = &rs600_page_flip,
631 .post_page_flip = &rs600_post_page_flip,
632 },
Alex Deucher89e51812012-02-23 17:53:38 -0500633 .mc_wait_for_idle = &rs600_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000634};
635
636static struct radeon_asic rs690_asic = {
637 .init = &rs690_init,
638 .fini = &rs690_fini,
639 .suspend = &rs690_suspend,
640 .resume = &rs690_resume,
641 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000642 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000643 .asic_reset = &rs600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500644 .gart = {
645 .tlb_flush = &rs400_gart_tlb_flush,
646 .set_page = &rs400_gart_set_page,
647 },
Christian König4c87bc22011-10-19 19:02:21 +0200648 .ring = {
649 [RADEON_RING_TYPE_GFX_INDEX] = {
650 .ib_execute = &r100_ring_ib_execute,
651 .emit_fence = &r300_fence_ring_emit,
652 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100653 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500654 .ring_start = &r300_ring_start,
655 .ring_test = &r100_ring_test,
656 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200657 }
658 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500659 .irq = {
660 .set = &rs600_irq_set,
661 .process = &rs600_irq_process,
662 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500663 .display = {
664 .get_vblank_counter = &rs600_get_vblank_counter,
665 .bandwidth_update = &rs690_bandwidth_update,
666 .wait_for_vblank = &avivo_wait_for_vblank,
667 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500668 .copy = {
669 .blit = &r100_copy_blit,
670 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
671 .dma = &r200_copy_dma,
672 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
673 .copy = &r200_copy_dma,
674 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
675 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000676 .set_surface_reg = r100_set_surface_reg,
677 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500678 .hpd = {
679 .init = &rs600_hpd_init,
680 .fini = &rs600_hpd_fini,
681 .sense = &rs600_hpd_sense,
682 .set_polarity = &rs600_hpd_set_polarity,
683 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000684 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400685 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500686 .pm = {
687 .misc = &rs600_pm_misc,
688 .prepare = &rs600_pm_prepare,
689 .finish = &rs600_pm_finish,
690 .init_profile = &r420_pm_init_profile,
691 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500692 .get_engine_clock = &radeon_atom_get_engine_clock,
693 .set_engine_clock = &radeon_atom_set_engine_clock,
694 .get_memory_clock = &radeon_atom_get_memory_clock,
695 .set_memory_clock = &radeon_atom_set_memory_clock,
696 .get_pcie_lanes = NULL,
697 .set_pcie_lanes = NULL,
698 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500699 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500700 .pflip = {
701 .pre_page_flip = &rs600_pre_page_flip,
702 .page_flip = &rs600_page_flip,
703 .post_page_flip = &rs600_post_page_flip,
704 },
Alex Deucher89e51812012-02-23 17:53:38 -0500705 .mc_wait_for_idle = &rs690_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000706};
707
708static struct radeon_asic rv515_asic = {
709 .init = &rv515_init,
710 .fini = &rv515_fini,
711 .suspend = &rv515_suspend,
712 .resume = &rv515_resume,
713 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000714 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000715 .asic_reset = &rs600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500716 .gart = {
717 .tlb_flush = &rv370_pcie_gart_tlb_flush,
718 .set_page = &rv370_pcie_gart_set_page,
719 },
Christian König4c87bc22011-10-19 19:02:21 +0200720 .ring = {
721 [RADEON_RING_TYPE_GFX_INDEX] = {
722 .ib_execute = &r100_ring_ib_execute,
723 .emit_fence = &r300_fence_ring_emit,
724 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100725 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500726 .ring_start = &rv515_ring_start,
727 .ring_test = &r100_ring_test,
728 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200729 }
730 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500731 .irq = {
732 .set = &rs600_irq_set,
733 .process = &rs600_irq_process,
734 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500735 .display = {
736 .get_vblank_counter = &rs600_get_vblank_counter,
737 .bandwidth_update = &rv515_bandwidth_update,
738 .wait_for_vblank = &avivo_wait_for_vblank,
739 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500740 .copy = {
741 .blit = &r100_copy_blit,
742 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
743 .dma = &r200_copy_dma,
744 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
745 .copy = &r100_copy_blit,
746 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
747 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000748 .set_surface_reg = r100_set_surface_reg,
749 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500750 .hpd = {
751 .init = &rs600_hpd_init,
752 .fini = &rs600_hpd_fini,
753 .sense = &rs600_hpd_sense,
754 .set_polarity = &rs600_hpd_set_polarity,
755 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000756 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400757 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500758 .pm = {
759 .misc = &rs600_pm_misc,
760 .prepare = &rs600_pm_prepare,
761 .finish = &rs600_pm_finish,
762 .init_profile = &r420_pm_init_profile,
763 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500764 .get_engine_clock = &radeon_atom_get_engine_clock,
765 .set_engine_clock = &radeon_atom_set_engine_clock,
766 .get_memory_clock = &radeon_atom_get_memory_clock,
767 .set_memory_clock = &radeon_atom_set_memory_clock,
768 .get_pcie_lanes = &rv370_get_pcie_lanes,
769 .set_pcie_lanes = &rv370_set_pcie_lanes,
770 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500771 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500772 .pflip = {
773 .pre_page_flip = &rs600_pre_page_flip,
774 .page_flip = &rs600_page_flip,
775 .post_page_flip = &rs600_post_page_flip,
776 },
Alex Deucher89e51812012-02-23 17:53:38 -0500777 .mc_wait_for_idle = &rv515_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000778};
779
780static struct radeon_asic r520_asic = {
781 .init = &r520_init,
782 .fini = &rv515_fini,
783 .suspend = &rv515_suspend,
784 .resume = &r520_resume,
785 .vga_set_state = &r100_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000786 .gpu_is_lockup = &r300_gpu_is_lockup,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000787 .asic_reset = &rs600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500788 .gart = {
789 .tlb_flush = &rv370_pcie_gart_tlb_flush,
790 .set_page = &rv370_pcie_gart_set_page,
791 },
Christian König4c87bc22011-10-19 19:02:21 +0200792 .ring = {
793 [RADEON_RING_TYPE_GFX_INDEX] = {
794 .ib_execute = &r100_ring_ib_execute,
795 .emit_fence = &r300_fence_ring_emit,
796 .emit_semaphore = &r100_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100797 .cs_parse = &r300_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500798 .ring_start = &rv515_ring_start,
799 .ring_test = &r100_ring_test,
800 .ib_test = &r100_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200801 }
802 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500803 .irq = {
804 .set = &rs600_irq_set,
805 .process = &rs600_irq_process,
806 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500807 .display = {
808 .bandwidth_update = &rv515_bandwidth_update,
809 .get_vblank_counter = &rs600_get_vblank_counter,
810 .wait_for_vblank = &avivo_wait_for_vblank,
811 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500812 .copy = {
813 .blit = &r100_copy_blit,
814 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
815 .dma = &r200_copy_dma,
816 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
817 .copy = &r100_copy_blit,
818 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
819 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000820 .set_surface_reg = r100_set_surface_reg,
821 .clear_surface_reg = r100_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500822 .hpd = {
823 .init = &rs600_hpd_init,
824 .fini = &rs600_hpd_fini,
825 .sense = &rs600_hpd_sense,
826 .set_polarity = &rs600_hpd_set_polarity,
827 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000828 .ioctl_wait_idle = NULL,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400829 .gui_idle = &r100_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500830 .pm = {
831 .misc = &rs600_pm_misc,
832 .prepare = &rs600_pm_prepare,
833 .finish = &rs600_pm_finish,
834 .init_profile = &r420_pm_init_profile,
835 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500836 .get_engine_clock = &radeon_atom_get_engine_clock,
837 .set_engine_clock = &radeon_atom_set_engine_clock,
838 .get_memory_clock = &radeon_atom_get_memory_clock,
839 .set_memory_clock = &radeon_atom_set_memory_clock,
840 .get_pcie_lanes = &rv370_get_pcie_lanes,
841 .set_pcie_lanes = &rv370_set_pcie_lanes,
842 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500843 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500844 .pflip = {
845 .pre_page_flip = &rs600_pre_page_flip,
846 .page_flip = &rs600_page_flip,
847 .post_page_flip = &rs600_post_page_flip,
848 },
Alex Deucher89e51812012-02-23 17:53:38 -0500849 .mc_wait_for_idle = &r520_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000850};
851
852static struct radeon_asic r600_asic = {
853 .init = &r600_init,
854 .fini = &r600_fini,
855 .suspend = &r600_suspend,
856 .resume = &r600_resume,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000857 .vga_set_state = &r600_vga_set_state,
Jerome Glisse225758d2010-03-09 14:45:10 +0000858 .gpu_is_lockup = &r600_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000859 .asic_reset = &r600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500860 .gart = {
861 .tlb_flush = &r600_pcie_gart_tlb_flush,
862 .set_page = &rs600_gart_set_page,
863 },
Christian König4c87bc22011-10-19 19:02:21 +0200864 .ring = {
865 [RADEON_RING_TYPE_GFX_INDEX] = {
866 .ib_execute = &r600_ring_ib_execute,
867 .emit_fence = &r600_fence_ring_emit,
868 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100869 .cs_parse = &r600_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500870 .ring_test = &r600_ring_test,
871 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200872 }
873 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500874 .irq = {
875 .set = &r600_irq_set,
876 .process = &r600_irq_process,
877 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500878 .display = {
879 .bandwidth_update = &rv515_bandwidth_update,
880 .get_vblank_counter = &rs600_get_vblank_counter,
881 .wait_for_vblank = &avivo_wait_for_vblank,
882 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500883 .copy = {
884 .blit = &r600_copy_blit,
885 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
886 .dma = NULL,
887 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
888 .copy = &r600_copy_blit,
889 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
890 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000891 .set_surface_reg = r600_set_surface_reg,
892 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500893 .hpd = {
894 .init = &r600_hpd_init,
895 .fini = &r600_hpd_fini,
896 .sense = &r600_hpd_sense,
897 .set_polarity = &r600_hpd_set_polarity,
898 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000899 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400900 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500901 .pm = {
902 .misc = &r600_pm_misc,
903 .prepare = &rs600_pm_prepare,
904 .finish = &rs600_pm_finish,
905 .init_profile = &r600_pm_init_profile,
906 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500907 .get_engine_clock = &radeon_atom_get_engine_clock,
908 .set_engine_clock = &radeon_atom_set_engine_clock,
909 .get_memory_clock = &radeon_atom_get_memory_clock,
910 .set_memory_clock = &radeon_atom_set_memory_clock,
911 .get_pcie_lanes = &r600_get_pcie_lanes,
912 .set_pcie_lanes = &r600_set_pcie_lanes,
913 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -0500914 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500915 .pflip = {
916 .pre_page_flip = &rs600_pre_page_flip,
917 .page_flip = &rs600_page_flip,
918 .post_page_flip = &rs600_post_page_flip,
919 },
Alex Deucher89e51812012-02-23 17:53:38 -0500920 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000921};
922
Alex Deucherf47299c2010-03-16 20:54:38 -0400923static struct radeon_asic rs780_asic = {
924 .init = &r600_init,
925 .fini = &r600_fini,
926 .suspend = &r600_suspend,
927 .resume = &r600_resume,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000928 .gpu_is_lockup = &r600_gpu_is_lockup,
Alex Deucherf47299c2010-03-16 20:54:38 -0400929 .vga_set_state = &r600_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000930 .asic_reset = &r600_asic_reset,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500931 .gart = {
932 .tlb_flush = &r600_pcie_gart_tlb_flush,
933 .set_page = &rs600_gart_set_page,
934 },
Christian König4c87bc22011-10-19 19:02:21 +0200935 .ring = {
936 [RADEON_RING_TYPE_GFX_INDEX] = {
937 .ib_execute = &r600_ring_ib_execute,
938 .emit_fence = &r600_fence_ring_emit,
939 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +0100940 .cs_parse = &r600_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -0500941 .ring_test = &r600_ring_test,
942 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +0200943 }
944 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500945 .irq = {
946 .set = &r600_irq_set,
947 .process = &r600_irq_process,
948 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500949 .display = {
950 .bandwidth_update = &rs690_bandwidth_update,
951 .get_vblank_counter = &rs600_get_vblank_counter,
952 .wait_for_vblank = &avivo_wait_for_vblank,
953 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500954 .copy = {
955 .blit = &r600_copy_blit,
956 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
957 .dma = NULL,
958 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
959 .copy = &r600_copy_blit,
960 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
961 },
Alex Deucherf47299c2010-03-16 20:54:38 -0400962 .set_surface_reg = r600_set_surface_reg,
963 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -0500964 .hpd = {
965 .init = &r600_hpd_init,
966 .fini = &r600_hpd_fini,
967 .sense = &r600_hpd_sense,
968 .set_polarity = &r600_hpd_set_polarity,
969 },
Alex Deucherf47299c2010-03-16 20:54:38 -0400970 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deucherdef9ba92010-04-22 12:39:58 -0400971 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -0500972 .pm = {
973 .misc = &r600_pm_misc,
974 .prepare = &rs600_pm_prepare,
975 .finish = &rs600_pm_finish,
976 .init_profile = &rs780_pm_init_profile,
977 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500978 .get_engine_clock = &radeon_atom_get_engine_clock,
979 .set_engine_clock = &radeon_atom_set_engine_clock,
980 .get_memory_clock = NULL,
981 .set_memory_clock = NULL,
982 .get_pcie_lanes = NULL,
983 .set_pcie_lanes = NULL,
984 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -0500985 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500986 .pflip = {
987 .pre_page_flip = &rs600_pre_page_flip,
988 .page_flip = &rs600_page_flip,
989 .post_page_flip = &rs600_post_page_flip,
990 },
Alex Deucher89e51812012-02-23 17:53:38 -0500991 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Alex Deucherf47299c2010-03-16 20:54:38 -0400992};
993
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000994static struct radeon_asic rv770_asic = {
995 .init = &rv770_init,
996 .fini = &rv770_fini,
997 .suspend = &rv770_suspend,
998 .resume = &rv770_resume,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000999 .asic_reset = &r600_asic_reset,
Jerome Glisse225758d2010-03-09 14:45:10 +00001000 .gpu_is_lockup = &r600_gpu_is_lockup,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001001 .vga_set_state = &r600_vga_set_state,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001002 .gart = {
1003 .tlb_flush = &r600_pcie_gart_tlb_flush,
1004 .set_page = &rs600_gart_set_page,
1005 },
Christian König4c87bc22011-10-19 19:02:21 +02001006 .ring = {
1007 [RADEON_RING_TYPE_GFX_INDEX] = {
1008 .ib_execute = &r600_ring_ib_execute,
1009 .emit_fence = &r600_fence_ring_emit,
1010 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001011 .cs_parse = &r600_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001012 .ring_test = &r600_ring_test,
1013 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001014 }
1015 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001016 .irq = {
1017 .set = &r600_irq_set,
1018 .process = &r600_irq_process,
1019 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001020 .display = {
1021 .bandwidth_update = &rv515_bandwidth_update,
1022 .get_vblank_counter = &rs600_get_vblank_counter,
1023 .wait_for_vblank = &avivo_wait_for_vblank,
1024 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001025 .copy = {
1026 .blit = &r600_copy_blit,
1027 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1028 .dma = NULL,
1029 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1030 .copy = &r600_copy_blit,
1031 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1032 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001033 .set_surface_reg = r600_set_surface_reg,
1034 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -05001035 .hpd = {
1036 .init = &r600_hpd_init,
1037 .fini = &r600_hpd_fini,
1038 .sense = &r600_hpd_sense,
1039 .set_polarity = &r600_hpd_set_polarity,
1040 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001041 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deucherdef9ba92010-04-22 12:39:58 -04001042 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -05001043 .pm = {
1044 .misc = &rv770_pm_misc,
1045 .prepare = &rs600_pm_prepare,
1046 .finish = &rs600_pm_finish,
1047 .init_profile = &r600_pm_init_profile,
1048 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001049 .get_engine_clock = &radeon_atom_get_engine_clock,
1050 .set_engine_clock = &radeon_atom_set_engine_clock,
1051 .get_memory_clock = &radeon_atom_get_memory_clock,
1052 .set_memory_clock = &radeon_atom_set_memory_clock,
1053 .get_pcie_lanes = &r600_get_pcie_lanes,
1054 .set_pcie_lanes = &r600_set_pcie_lanes,
1055 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -05001056 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001057 .pflip = {
1058 .pre_page_flip = &rs600_pre_page_flip,
1059 .page_flip = &rv770_page_flip,
1060 .post_page_flip = &rs600_post_page_flip,
1061 },
Alex Deucher89e51812012-02-23 17:53:38 -05001062 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001063};
1064
1065static struct radeon_asic evergreen_asic = {
1066 .init = &evergreen_init,
1067 .fini = &evergreen_fini,
1068 .suspend = &evergreen_suspend,
1069 .resume = &evergreen_resume,
Jerome Glisse225758d2010-03-09 14:45:10 +00001070 .gpu_is_lockup = &evergreen_gpu_is_lockup,
Jerome Glissea2d07b72010-03-09 14:45:11 +00001071 .asic_reset = &evergreen_asic_reset,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001072 .vga_set_state = &r600_vga_set_state,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001073 .gart = {
1074 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1075 .set_page = &rs600_gart_set_page,
1076 },
Christian König4c87bc22011-10-19 19:02:21 +02001077 .ring = {
1078 [RADEON_RING_TYPE_GFX_INDEX] = {
1079 .ib_execute = &evergreen_ring_ib_execute,
1080 .emit_fence = &r600_fence_ring_emit,
1081 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001082 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001083 .ring_test = &r600_ring_test,
1084 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001085 }
1086 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001087 .irq = {
1088 .set = &evergreen_irq_set,
1089 .process = &evergreen_irq_process,
1090 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001091 .display = {
1092 .bandwidth_update = &evergreen_bandwidth_update,
1093 .get_vblank_counter = &evergreen_get_vblank_counter,
1094 .wait_for_vblank = &dce4_wait_for_vblank,
1095 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001096 .copy = {
1097 .blit = &r600_copy_blit,
1098 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1099 .dma = NULL,
1100 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1101 .copy = &r600_copy_blit,
1102 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1103 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001104 .set_surface_reg = r600_set_surface_reg,
1105 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -05001106 .hpd = {
1107 .init = &evergreen_hpd_init,
1108 .fini = &evergreen_hpd_fini,
1109 .sense = &evergreen_hpd_sense,
1110 .set_polarity = &evergreen_hpd_set_polarity,
1111 },
Dave Airlie97bfd0a2011-05-19 14:14:43 +10001112 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deucherdef9ba92010-04-22 12:39:58 -04001113 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -05001114 .pm = {
1115 .misc = &evergreen_pm_misc,
1116 .prepare = &evergreen_pm_prepare,
1117 .finish = &evergreen_pm_finish,
1118 .init_profile = &r600_pm_init_profile,
1119 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001120 .get_engine_clock = &radeon_atom_get_engine_clock,
1121 .set_engine_clock = &radeon_atom_set_engine_clock,
1122 .get_memory_clock = &radeon_atom_get_memory_clock,
1123 .set_memory_clock = &radeon_atom_set_memory_clock,
1124 .get_pcie_lanes = &r600_get_pcie_lanes,
1125 .set_pcie_lanes = &r600_set_pcie_lanes,
1126 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -05001127 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001128 .pflip = {
1129 .pre_page_flip = &evergreen_pre_page_flip,
1130 .page_flip = &evergreen_page_flip,
1131 .post_page_flip = &evergreen_post_page_flip,
1132 },
Alex Deucher89e51812012-02-23 17:53:38 -05001133 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001134};
1135
Alex Deucher958261d2010-11-22 17:56:30 -05001136static struct radeon_asic sumo_asic = {
1137 .init = &evergreen_init,
1138 .fini = &evergreen_fini,
1139 .suspend = &evergreen_suspend,
1140 .resume = &evergreen_resume,
Alex Deucher958261d2010-11-22 17:56:30 -05001141 .gpu_is_lockup = &evergreen_gpu_is_lockup,
1142 .asic_reset = &evergreen_asic_reset,
1143 .vga_set_state = &r600_vga_set_state,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001144 .gart = {
1145 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1146 .set_page = &rs600_gart_set_page,
1147 },
Christian König4c87bc22011-10-19 19:02:21 +02001148 .ring = {
1149 [RADEON_RING_TYPE_GFX_INDEX] = {
1150 .ib_execute = &evergreen_ring_ib_execute,
1151 .emit_fence = &r600_fence_ring_emit,
1152 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001153 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001154 .ring_test = &r600_ring_test,
1155 .ib_test = &r600_ib_test,
Christian Königeb0c19c2012-02-23 15:18:44 +01001156 },
Christian König4c87bc22011-10-19 19:02:21 +02001157 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001158 .irq = {
1159 .set = &evergreen_irq_set,
1160 .process = &evergreen_irq_process,
1161 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001162 .display = {
1163 .bandwidth_update = &evergreen_bandwidth_update,
1164 .get_vblank_counter = &evergreen_get_vblank_counter,
1165 .wait_for_vblank = &dce4_wait_for_vblank,
1166 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001167 .copy = {
1168 .blit = &r600_copy_blit,
1169 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1170 .dma = NULL,
1171 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1172 .copy = &r600_copy_blit,
1173 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1174 },
Alex Deucher958261d2010-11-22 17:56:30 -05001175 .set_surface_reg = r600_set_surface_reg,
1176 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -05001177 .hpd = {
1178 .init = &evergreen_hpd_init,
1179 .fini = &evergreen_hpd_fini,
1180 .sense = &evergreen_hpd_sense,
1181 .set_polarity = &evergreen_hpd_set_polarity,
1182 },
Dave Airlie97bfd0a2011-05-19 14:14:43 +10001183 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deucher958261d2010-11-22 17:56:30 -05001184 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -05001185 .pm = {
1186 .misc = &evergreen_pm_misc,
1187 .prepare = &evergreen_pm_prepare,
1188 .finish = &evergreen_pm_finish,
1189 .init_profile = &sumo_pm_init_profile,
1190 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001191 .get_engine_clock = &radeon_atom_get_engine_clock,
1192 .set_engine_clock = &radeon_atom_set_engine_clock,
1193 .get_memory_clock = NULL,
1194 .set_memory_clock = NULL,
1195 .get_pcie_lanes = NULL,
1196 .set_pcie_lanes = NULL,
1197 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -05001198 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001199 .pflip = {
1200 .pre_page_flip = &evergreen_pre_page_flip,
1201 .page_flip = &evergreen_page_flip,
1202 .post_page_flip = &evergreen_post_page_flip,
1203 },
Alex Deucher89e51812012-02-23 17:53:38 -05001204 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher958261d2010-11-22 17:56:30 -05001205};
1206
Alex Deuchera43b7662011-01-06 21:19:33 -05001207static struct radeon_asic btc_asic = {
1208 .init = &evergreen_init,
1209 .fini = &evergreen_fini,
1210 .suspend = &evergreen_suspend,
1211 .resume = &evergreen_resume,
Alex Deuchera43b7662011-01-06 21:19:33 -05001212 .gpu_is_lockup = &evergreen_gpu_is_lockup,
1213 .asic_reset = &evergreen_asic_reset,
1214 .vga_set_state = &r600_vga_set_state,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001215 .gart = {
1216 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
1217 .set_page = &rs600_gart_set_page,
1218 },
Christian König4c87bc22011-10-19 19:02:21 +02001219 .ring = {
1220 [RADEON_RING_TYPE_GFX_INDEX] = {
1221 .ib_execute = &evergreen_ring_ib_execute,
1222 .emit_fence = &r600_fence_ring_emit,
1223 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001224 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001225 .ring_test = &r600_ring_test,
1226 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001227 }
1228 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001229 .irq = {
1230 .set = &evergreen_irq_set,
1231 .process = &evergreen_irq_process,
1232 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001233 .display = {
1234 .bandwidth_update = &evergreen_bandwidth_update,
1235 .get_vblank_counter = &evergreen_get_vblank_counter,
1236 .wait_for_vblank = &dce4_wait_for_vblank,
1237 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001238 .copy = {
1239 .blit = &r600_copy_blit,
1240 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1241 .dma = NULL,
1242 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1243 .copy = &r600_copy_blit,
1244 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1245 },
Alex Deuchera43b7662011-01-06 21:19:33 -05001246 .set_surface_reg = r600_set_surface_reg,
1247 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -05001248 .hpd = {
1249 .init = &evergreen_hpd_init,
1250 .fini = &evergreen_hpd_fini,
1251 .sense = &evergreen_hpd_sense,
1252 .set_polarity = &evergreen_hpd_set_polarity,
1253 },
Dave Airlie97bfd0a2011-05-19 14:14:43 +10001254 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deuchera43b7662011-01-06 21:19:33 -05001255 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -05001256 .pm = {
1257 .misc = &evergreen_pm_misc,
1258 .prepare = &evergreen_pm_prepare,
1259 .finish = &evergreen_pm_finish,
1260 .init_profile = &r600_pm_init_profile,
1261 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001262 .get_engine_clock = &radeon_atom_get_engine_clock,
1263 .set_engine_clock = &radeon_atom_set_engine_clock,
1264 .get_memory_clock = &radeon_atom_get_memory_clock,
1265 .set_memory_clock = &radeon_atom_set_memory_clock,
1266 .get_pcie_lanes = NULL,
1267 .set_pcie_lanes = NULL,
1268 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -05001269 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001270 .pflip = {
1271 .pre_page_flip = &evergreen_pre_page_flip,
1272 .page_flip = &evergreen_page_flip,
1273 .post_page_flip = &evergreen_post_page_flip,
1274 },
Alex Deucher89e51812012-02-23 17:53:38 -05001275 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deuchera43b7662011-01-06 21:19:33 -05001276};
1277
Jerome Glisse721604a2012-01-05 22:11:05 -05001278static const struct radeon_vm_funcs cayman_vm_funcs = {
1279 .init = &cayman_vm_init,
1280 .fini = &cayman_vm_fini,
1281 .bind = &cayman_vm_bind,
1282 .unbind = &cayman_vm_unbind,
1283 .tlb_flush = &cayman_vm_tlb_flush,
1284 .page_flags = &cayman_vm_page_flags,
1285 .set_page = &cayman_vm_set_page,
1286};
1287
Alex Deuchere3487622011-03-02 20:07:36 -05001288static struct radeon_asic cayman_asic = {
1289 .init = &cayman_init,
1290 .fini = &cayman_fini,
1291 .suspend = &cayman_suspend,
1292 .resume = &cayman_resume,
Alex Deuchere3487622011-03-02 20:07:36 -05001293 .gpu_is_lockup = &cayman_gpu_is_lockup,
1294 .asic_reset = &cayman_asic_reset,
1295 .vga_set_state = &r600_vga_set_state,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001296 .gart = {
1297 .tlb_flush = &cayman_pcie_gart_tlb_flush,
1298 .set_page = &rs600_gart_set_page,
1299 },
Christian König4c87bc22011-10-19 19:02:21 +02001300 .ring = {
1301 [RADEON_RING_TYPE_GFX_INDEX] = {
Jerome Glisse721604a2012-01-05 22:11:05 -05001302 .ib_execute = &cayman_ring_ib_execute,
1303 .ib_parse = &evergreen_ib_parse,
Alex Deucherb40e7e12011-11-17 14:57:50 -05001304 .emit_fence = &cayman_fence_ring_emit,
Christian König4c87bc22011-10-19 19:02:21 +02001305 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001306 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001307 .ring_test = &r600_ring_test,
1308 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001309 },
1310 [CAYMAN_RING_TYPE_CP1_INDEX] = {
Jerome Glisse721604a2012-01-05 22:11:05 -05001311 .ib_execute = &cayman_ring_ib_execute,
1312 .ib_parse = &evergreen_ib_parse,
Alex Deucherb40e7e12011-11-17 14:57:50 -05001313 .emit_fence = &cayman_fence_ring_emit,
Christian König4c87bc22011-10-19 19:02:21 +02001314 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001315 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001316 .ring_test = &r600_ring_test,
1317 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001318 },
1319 [CAYMAN_RING_TYPE_CP2_INDEX] = {
Jerome Glisse721604a2012-01-05 22:11:05 -05001320 .ib_execute = &cayman_ring_ib_execute,
1321 .ib_parse = &evergreen_ib_parse,
Alex Deucherb40e7e12011-11-17 14:57:50 -05001322 .emit_fence = &cayman_fence_ring_emit,
Christian König4c87bc22011-10-19 19:02:21 +02001323 .emit_semaphore = &r600_semaphore_ring_emit,
Christian Königeb0c19c2012-02-23 15:18:44 +01001324 .cs_parse = &evergreen_cs_parse,
Alex Deucherf7128122012-02-23 17:53:45 -05001325 .ring_test = &r600_ring_test,
1326 .ib_test = &r600_ib_test,
Christian König4c87bc22011-10-19 19:02:21 +02001327 }
1328 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001329 .irq = {
1330 .set = &evergreen_irq_set,
1331 .process = &evergreen_irq_process,
1332 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001333 .display = {
1334 .bandwidth_update = &evergreen_bandwidth_update,
1335 .get_vblank_counter = &evergreen_get_vblank_counter,
1336 .wait_for_vblank = &dce4_wait_for_vblank,
1337 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001338 .copy = {
1339 .blit = &r600_copy_blit,
1340 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1341 .dma = NULL,
1342 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1343 .copy = &r600_copy_blit,
1344 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1345 },
Alex Deuchere3487622011-03-02 20:07:36 -05001346 .set_surface_reg = r600_set_surface_reg,
1347 .clear_surface_reg = r600_clear_surface_reg,
Alex Deucher901ea572012-02-23 17:53:39 -05001348 .hpd = {
1349 .init = &evergreen_hpd_init,
1350 .fini = &evergreen_hpd_fini,
1351 .sense = &evergreen_hpd_sense,
1352 .set_polarity = &evergreen_hpd_set_polarity,
1353 },
Dave Airlie97bfd0a2011-05-19 14:14:43 +10001354 .ioctl_wait_idle = r600_ioctl_wait_idle,
Alex Deuchere3487622011-03-02 20:07:36 -05001355 .gui_idle = &r600_gui_idle,
Alex Deuchera02fa392012-02-23 17:53:41 -05001356 .pm = {
1357 .misc = &evergreen_pm_misc,
1358 .prepare = &evergreen_pm_prepare,
1359 .finish = &evergreen_pm_finish,
1360 .init_profile = &r600_pm_init_profile,
1361 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001362 .get_engine_clock = &radeon_atom_get_engine_clock,
1363 .set_engine_clock = &radeon_atom_set_engine_clock,
1364 .get_memory_clock = &radeon_atom_get_memory_clock,
1365 .set_memory_clock = &radeon_atom_set_memory_clock,
1366 .get_pcie_lanes = NULL,
1367 .set_pcie_lanes = NULL,
1368 .set_clock_gating = NULL,
Alex Deuchera02fa392012-02-23 17:53:41 -05001369 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001370 .pflip = {
1371 .pre_page_flip = &evergreen_pre_page_flip,
1372 .page_flip = &evergreen_page_flip,
1373 .post_page_flip = &evergreen_post_page_flip,
1374 },
Alex Deucher89e51812012-02-23 17:53:38 -05001375 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deuchere3487622011-03-02 20:07:36 -05001376};
1377
Daniel Vetter0a10c852010-03-11 21:19:14 +00001378int radeon_asic_init(struct radeon_device *rdev)
1379{
1380 radeon_register_accessor_init(rdev);
Alex Deucherba7e05e2011-06-16 18:14:22 +00001381
1382 /* set the number of crtcs */
1383 if (rdev->flags & RADEON_SINGLE_CRTC)
1384 rdev->num_crtc = 1;
1385 else
1386 rdev->num_crtc = 2;
1387
Daniel Vetter0a10c852010-03-11 21:19:14 +00001388 switch (rdev->family) {
1389 case CHIP_R100:
1390 case CHIP_RV100:
1391 case CHIP_RS100:
1392 case CHIP_RV200:
1393 case CHIP_RS200:
1394 rdev->asic = &r100_asic;
1395 break;
1396 case CHIP_R200:
1397 case CHIP_RV250:
1398 case CHIP_RS300:
1399 case CHIP_RV280:
1400 rdev->asic = &r200_asic;
1401 break;
1402 case CHIP_R300:
1403 case CHIP_R350:
1404 case CHIP_RV350:
1405 case CHIP_RV380:
1406 if (rdev->flags & RADEON_IS_PCIE)
1407 rdev->asic = &r300_asic_pcie;
1408 else
1409 rdev->asic = &r300_asic;
1410 break;
1411 case CHIP_R420:
1412 case CHIP_R423:
1413 case CHIP_RV410:
1414 rdev->asic = &r420_asic;
Alex Deucher07bb0842010-06-22 21:58:26 -04001415 /* handle macs */
1416 if (rdev->bios == NULL) {
Alex Deucher798bcf72012-02-23 17:53:48 -05001417 rdev->asic->pm.get_engine_clock = &radeon_legacy_get_engine_clock;
1418 rdev->asic->pm.set_engine_clock = &radeon_legacy_set_engine_clock;
1419 rdev->asic->pm.get_memory_clock = &radeon_legacy_get_memory_clock;
1420 rdev->asic->pm.set_memory_clock = NULL;
Alex Deucher07bb0842010-06-22 21:58:26 -04001421 }
Daniel Vetter0a10c852010-03-11 21:19:14 +00001422 break;
1423 case CHIP_RS400:
1424 case CHIP_RS480:
1425 rdev->asic = &rs400_asic;
1426 break;
1427 case CHIP_RS600:
1428 rdev->asic = &rs600_asic;
1429 break;
1430 case CHIP_RS690:
1431 case CHIP_RS740:
1432 rdev->asic = &rs690_asic;
1433 break;
1434 case CHIP_RV515:
1435 rdev->asic = &rv515_asic;
1436 break;
1437 case CHIP_R520:
1438 case CHIP_RV530:
1439 case CHIP_RV560:
1440 case CHIP_RV570:
1441 case CHIP_R580:
1442 rdev->asic = &r520_asic;
1443 break;
1444 case CHIP_R600:
1445 case CHIP_RV610:
1446 case CHIP_RV630:
1447 case CHIP_RV620:
1448 case CHIP_RV635:
1449 case CHIP_RV670:
Alex Deucherf47299c2010-03-16 20:54:38 -04001450 rdev->asic = &r600_asic;
1451 break;
Daniel Vetter0a10c852010-03-11 21:19:14 +00001452 case CHIP_RS780:
1453 case CHIP_RS880:
Alex Deucherf47299c2010-03-16 20:54:38 -04001454 rdev->asic = &rs780_asic;
Daniel Vetter0a10c852010-03-11 21:19:14 +00001455 break;
1456 case CHIP_RV770:
1457 case CHIP_RV730:
1458 case CHIP_RV710:
1459 case CHIP_RV740:
1460 rdev->asic = &rv770_asic;
1461 break;
1462 case CHIP_CEDAR:
1463 case CHIP_REDWOOD:
1464 case CHIP_JUNIPER:
1465 case CHIP_CYPRESS:
1466 case CHIP_HEMLOCK:
Alex Deucherba7e05e2011-06-16 18:14:22 +00001467 /* set num crtcs */
1468 if (rdev->family == CHIP_CEDAR)
1469 rdev->num_crtc = 4;
1470 else
1471 rdev->num_crtc = 6;
Daniel Vetter0a10c852010-03-11 21:19:14 +00001472 rdev->asic = &evergreen_asic;
1473 break;
Alex Deucher958261d2010-11-22 17:56:30 -05001474 case CHIP_PALM:
Alex Deucher89da5a32011-05-31 15:42:47 -04001475 case CHIP_SUMO:
1476 case CHIP_SUMO2:
Alex Deucher958261d2010-11-22 17:56:30 -05001477 rdev->asic = &sumo_asic;
1478 break;
Alex Deuchera43b7662011-01-06 21:19:33 -05001479 case CHIP_BARTS:
1480 case CHIP_TURKS:
1481 case CHIP_CAICOS:
Alex Deucherba7e05e2011-06-16 18:14:22 +00001482 /* set num crtcs */
1483 if (rdev->family == CHIP_CAICOS)
1484 rdev->num_crtc = 4;
1485 else
1486 rdev->num_crtc = 6;
Alex Deuchera43b7662011-01-06 21:19:33 -05001487 rdev->asic = &btc_asic;
1488 break;
Alex Deuchere3487622011-03-02 20:07:36 -05001489 case CHIP_CAYMAN:
1490 rdev->asic = &cayman_asic;
Alex Deucherba7e05e2011-06-16 18:14:22 +00001491 /* set num crtcs */
1492 rdev->num_crtc = 6;
Jerome Glisse721604a2012-01-05 22:11:05 -05001493 rdev->vm_manager.funcs = &cayman_vm_funcs;
Alex Deuchere3487622011-03-02 20:07:36 -05001494 break;
Daniel Vetter0a10c852010-03-11 21:19:14 +00001495 default:
1496 /* FIXME: not supported yet */
1497 return -EINVAL;
1498 }
1499
1500 if (rdev->flags & RADEON_IS_IGP) {
Alex Deucher798bcf72012-02-23 17:53:48 -05001501 rdev->asic->pm.get_memory_clock = NULL;
1502 rdev->asic->pm.set_memory_clock = NULL;
Daniel Vetter0a10c852010-03-11 21:19:14 +00001503 }
1504
Daniel Vetter0a10c852010-03-11 21:19:14 +00001505 return 0;
1506}
1507