blob: bc5121d1a7bc56f777c7a1ef76c49c8753cd8ed4 [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>
Daniel Vetter0a10c852010-03-11 21:19:14 +000034#include "radeon_reg.h"
35#include "radeon.h"
36#include "radeon_asic.h"
37#include "atom.h"
38
39/*
40 * Registers accessors functions.
41 */
Alex Deucherabf1dc62012-07-17 14:02:36 -040042/**
43 * radeon_invalid_rreg - dummy reg read function
44 *
45 * @rdev: radeon device pointer
46 * @reg: offset of register
47 *
48 * Dummy register read function. Used for register blocks
49 * that certain asics don't have (all asics).
50 * Returns the value in the register.
51 */
Daniel Vetter0a10c852010-03-11 21:19:14 +000052static uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg)
53{
54 DRM_ERROR("Invalid callback to read register 0x%04X\n", reg);
55 BUG_ON(1);
56 return 0;
57}
58
Alex Deucherabf1dc62012-07-17 14:02:36 -040059/**
60 * radeon_invalid_wreg - dummy reg write function
61 *
62 * @rdev: radeon device pointer
63 * @reg: offset of register
64 * @v: value to write to the register
65 *
66 * Dummy register read function. Used for register blocks
67 * that certain asics don't have (all asics).
68 */
Daniel Vetter0a10c852010-03-11 21:19:14 +000069static void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
70{
71 DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n",
72 reg, v);
73 BUG_ON(1);
74}
75
Alex Deucherabf1dc62012-07-17 14:02:36 -040076/**
77 * radeon_register_accessor_init - sets up the register accessor callbacks
78 *
79 * @rdev: radeon device pointer
80 *
81 * Sets up the register accessor callbacks for various register
82 * apertures. Not all asics have all apertures (all asics).
83 */
Daniel Vetter0a10c852010-03-11 21:19:14 +000084static void radeon_register_accessor_init(struct radeon_device *rdev)
85{
86 rdev->mc_rreg = &radeon_invalid_rreg;
87 rdev->mc_wreg = &radeon_invalid_wreg;
88 rdev->pll_rreg = &radeon_invalid_rreg;
89 rdev->pll_wreg = &radeon_invalid_wreg;
90 rdev->pciep_rreg = &radeon_invalid_rreg;
91 rdev->pciep_wreg = &radeon_invalid_wreg;
92
93 /* Don't change order as we are overridding accessor. */
94 if (rdev->family < CHIP_RV515) {
95 rdev->pcie_reg_mask = 0xff;
96 } else {
97 rdev->pcie_reg_mask = 0x7ff;
98 }
99 /* FIXME: not sure here */
100 if (rdev->family <= CHIP_R580) {
101 rdev->pll_rreg = &r100_pll_rreg;
102 rdev->pll_wreg = &r100_pll_wreg;
103 }
104 if (rdev->family >= CHIP_R420) {
105 rdev->mc_rreg = &r420_mc_rreg;
106 rdev->mc_wreg = &r420_mc_wreg;
107 }
108 if (rdev->family >= CHIP_RV515) {
109 rdev->mc_rreg = &rv515_mc_rreg;
110 rdev->mc_wreg = &rv515_mc_wreg;
111 }
112 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {
113 rdev->mc_rreg = &rs400_mc_rreg;
114 rdev->mc_wreg = &rs400_mc_wreg;
115 }
116 if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) {
117 rdev->mc_rreg = &rs690_mc_rreg;
118 rdev->mc_wreg = &rs690_mc_wreg;
119 }
120 if (rdev->family == CHIP_RS600) {
121 rdev->mc_rreg = &rs600_mc_rreg;
122 rdev->mc_wreg = &rs600_mc_wreg;
123 }
Samuel Li65337e62013-04-05 17:50:53 -0400124 if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) {
125 rdev->mc_rreg = &rs780_mc_rreg;
126 rdev->mc_wreg = &rs780_mc_wreg;
127 }
Alex Deucher6e2c3c02013-04-03 19:28:32 -0400128
129 if (rdev->family >= CHIP_BONAIRE) {
130 rdev->pciep_rreg = &cik_pciep_rreg;
131 rdev->pciep_wreg = &cik_pciep_wreg;
132 } else if (rdev->family >= CHIP_R600) {
Daniel Vetter0a10c852010-03-11 21:19:14 +0000133 rdev->pciep_rreg = &r600_pciep_rreg;
134 rdev->pciep_wreg = &r600_pciep_wreg;
135 }
136}
137
Alex Deucher18b53e92014-10-01 09:25:27 -0400138static int radeon_invalid_get_allowed_info_register(struct radeon_device *rdev,
139 u32 reg, u32 *val)
140{
141 return -EINVAL;
142}
Daniel Vetter0a10c852010-03-11 21:19:14 +0000143
144/* helper to disable agp */
Alex Deucherabf1dc62012-07-17 14:02:36 -0400145/**
146 * radeon_agp_disable - AGP disable helper function
147 *
148 * @rdev: radeon device pointer
149 *
150 * Removes AGP flags and changes the gart callbacks on AGP
151 * cards when using the internal gart rather than AGP (all asics).
152 */
Daniel Vetter0a10c852010-03-11 21:19:14 +0000153void radeon_agp_disable(struct radeon_device *rdev)
154{
155 rdev->flags &= ~RADEON_IS_AGP;
156 if (rdev->family >= CHIP_R600) {
157 DRM_INFO("Forcing AGP to PCIE mode\n");
158 rdev->flags |= RADEON_IS_PCIE;
159 } else if (rdev->family >= CHIP_RV515 ||
160 rdev->family == CHIP_RV380 ||
161 rdev->family == CHIP_RV410 ||
162 rdev->family == CHIP_R423) {
163 DRM_INFO("Forcing AGP to PCIE mode\n");
164 rdev->flags |= RADEON_IS_PCIE;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500165 rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
Michel Dänzercb658902015-01-21 17:36:35 +0900166 rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500167 rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
Daniel Vetter0a10c852010-03-11 21:19:14 +0000168 } else {
169 DRM_INFO("Forcing AGP to PCI mode\n");
170 rdev->flags |= RADEON_IS_PCI;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500171 rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
Michel Dänzercb658902015-01-21 17:36:35 +0900172 rdev->asic->gart.get_page_entry = &r100_pci_gart_get_page_entry;
Alex Deucherc5b3b852012-02-23 17:53:46 -0500173 rdev->asic->gart.set_page = &r100_pci_gart_set_page;
Daniel Vetter0a10c852010-03-11 21:19:14 +0000174 }
175 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
176}
177
178/*
179 * ASIC
180 */
Christian König76a0df82013-08-13 11:56:50 +0200181
Julia Lawalld26678d2015-11-29 17:12:41 +0100182static const struct radeon_asic_ring r100_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +0200183 .ib_execute = &r100_ring_ib_execute,
184 .emit_fence = &r100_fence_ring_emit,
185 .emit_semaphore = &r100_semaphore_ring_emit,
186 .cs_parse = &r100_cs_parse,
187 .ring_start = &r100_ring_start,
188 .ring_test = &r100_ring_test,
189 .ib_test = &r100_ib_test,
190 .is_lockup = &r100_gpu_is_lockup,
Alex Deucherea31bf62013-12-09 19:44:30 -0500191 .get_rptr = &r100_gfx_get_rptr,
192 .get_wptr = &r100_gfx_get_wptr,
193 .set_wptr = &r100_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +0200194};
195
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000196static struct radeon_asic r100_asic = {
197 .init = &r100_init,
198 .fini = &r100_fini,
199 .suspend = &r100_suspend,
200 .resume = &r100_resume,
201 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000202 .asic_reset = &r100_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900203 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500204 .gui_idle = &r100_gui_idle,
205 .mc_wait_for_idle = &r100_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400206 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500207 .gart = {
208 .tlb_flush = &r100_pci_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900209 .get_page_entry = &r100_pci_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500210 .set_page = &r100_pci_gart_set_page,
211 },
Christian König4c87bc22011-10-19 19:02:21 +0200212 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200213 [RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200214 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500215 .irq = {
216 .set = &r100_irq_set,
217 .process = &r100_irq_process,
218 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500219 .display = {
220 .bandwidth_update = &r100_bandwidth_update,
221 .get_vblank_counter = &r100_get_vblank_counter,
222 .wait_for_vblank = &r100_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400223 .set_backlight_level = &radeon_legacy_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400224 .get_backlight_level = &radeon_legacy_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500225 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500226 .copy = {
227 .blit = &r100_copy_blit,
228 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
229 .dma = NULL,
230 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
231 .copy = &r100_copy_blit,
232 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
233 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500234 .surface = {
235 .set_reg = r100_set_surface_reg,
236 .clear_reg = r100_clear_surface_reg,
237 },
Alex Deucher901ea572012-02-23 17:53:39 -0500238 .hpd = {
239 .init = &r100_hpd_init,
240 .fini = &r100_hpd_fini,
241 .sense = &r100_hpd_sense,
242 .set_polarity = &r100_hpd_set_polarity,
243 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500244 .pm = {
245 .misc = &r100_pm_misc,
246 .prepare = &r100_pm_prepare,
247 .finish = &r100_pm_finish,
248 .init_profile = &r100_pm_init_profile,
249 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500250 .get_engine_clock = &radeon_legacy_get_engine_clock,
251 .set_engine_clock = &radeon_legacy_set_engine_clock,
252 .get_memory_clock = &radeon_legacy_get_memory_clock,
253 .set_memory_clock = NULL,
254 .get_pcie_lanes = NULL,
255 .set_pcie_lanes = NULL,
256 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500257 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500258 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500259 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200260 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500261 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000262};
263
264static struct radeon_asic r200_asic = {
265 .init = &r100_init,
266 .fini = &r100_fini,
267 .suspend = &r100_suspend,
268 .resume = &r100_resume,
269 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000270 .asic_reset = &r100_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900271 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500272 .gui_idle = &r100_gui_idle,
273 .mc_wait_for_idle = &r100_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400274 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500275 .gart = {
276 .tlb_flush = &r100_pci_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900277 .get_page_entry = &r100_pci_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500278 .set_page = &r100_pci_gart_set_page,
279 },
Christian König4c87bc22011-10-19 19:02:21 +0200280 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200281 [RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200282 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500283 .irq = {
284 .set = &r100_irq_set,
285 .process = &r100_irq_process,
286 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500287 .display = {
288 .bandwidth_update = &r100_bandwidth_update,
289 .get_vblank_counter = &r100_get_vblank_counter,
290 .wait_for_vblank = &r100_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400291 .set_backlight_level = &radeon_legacy_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400292 .get_backlight_level = &radeon_legacy_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500293 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500294 .copy = {
295 .blit = &r100_copy_blit,
296 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
297 .dma = &r200_copy_dma,
298 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
299 .copy = &r100_copy_blit,
300 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
301 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500302 .surface = {
303 .set_reg = r100_set_surface_reg,
304 .clear_reg = r100_clear_surface_reg,
305 },
Alex Deucher901ea572012-02-23 17:53:39 -0500306 .hpd = {
307 .init = &r100_hpd_init,
308 .fini = &r100_hpd_fini,
309 .sense = &r100_hpd_sense,
310 .set_polarity = &r100_hpd_set_polarity,
311 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500312 .pm = {
313 .misc = &r100_pm_misc,
314 .prepare = &r100_pm_prepare,
315 .finish = &r100_pm_finish,
316 .init_profile = &r100_pm_init_profile,
317 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500318 .get_engine_clock = &radeon_legacy_get_engine_clock,
319 .set_engine_clock = &radeon_legacy_set_engine_clock,
320 .get_memory_clock = &radeon_legacy_get_memory_clock,
321 .set_memory_clock = NULL,
322 .get_pcie_lanes = NULL,
323 .set_pcie_lanes = NULL,
324 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500325 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500326 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500327 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200328 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500329 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000330};
331
Julia Lawalld26678d2015-11-29 17:12:41 +0100332static const struct radeon_asic_ring r300_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +0200333 .ib_execute = &r100_ring_ib_execute,
334 .emit_fence = &r300_fence_ring_emit,
335 .emit_semaphore = &r100_semaphore_ring_emit,
336 .cs_parse = &r300_cs_parse,
337 .ring_start = &r300_ring_start,
338 .ring_test = &r100_ring_test,
339 .ib_test = &r100_ib_test,
340 .is_lockup = &r100_gpu_is_lockup,
Alex Deucherea31bf62013-12-09 19:44:30 -0500341 .get_rptr = &r100_gfx_get_rptr,
342 .get_wptr = &r100_gfx_get_wptr,
343 .set_wptr = &r100_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +0200344};
345
Julia Lawalld26678d2015-11-29 17:12:41 +0100346static const struct radeon_asic_ring rv515_gfx_ring = {
Alex Deucherd8a74e12015-01-15 10:52:33 -0500347 .ib_execute = &r100_ring_ib_execute,
348 .emit_fence = &r300_fence_ring_emit,
349 .emit_semaphore = &r100_semaphore_ring_emit,
350 .cs_parse = &r300_cs_parse,
351 .ring_start = &rv515_ring_start,
352 .ring_test = &r100_ring_test,
353 .ib_test = &r100_ib_test,
354 .is_lockup = &r100_gpu_is_lockup,
355 .get_rptr = &r100_gfx_get_rptr,
356 .get_wptr = &r100_gfx_get_wptr,
357 .set_wptr = &r100_gfx_set_wptr,
358};
359
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000360static struct radeon_asic r300_asic = {
361 .init = &r300_init,
362 .fini = &r300_fini,
363 .suspend = &r300_suspend,
364 .resume = &r300_resume,
365 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000366 .asic_reset = &r300_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900367 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500368 .gui_idle = &r100_gui_idle,
369 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400370 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500371 .gart = {
372 .tlb_flush = &r100_pci_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900373 .get_page_entry = &r100_pci_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500374 .set_page = &r100_pci_gart_set_page,
375 },
Christian König4c87bc22011-10-19 19:02:21 +0200376 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200377 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200378 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500379 .irq = {
380 .set = &r100_irq_set,
381 .process = &r100_irq_process,
382 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500383 .display = {
384 .bandwidth_update = &r100_bandwidth_update,
385 .get_vblank_counter = &r100_get_vblank_counter,
386 .wait_for_vblank = &r100_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400387 .set_backlight_level = &radeon_legacy_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400388 .get_backlight_level = &radeon_legacy_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500389 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500390 .copy = {
391 .blit = &r100_copy_blit,
392 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
393 .dma = &r200_copy_dma,
394 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
395 .copy = &r100_copy_blit,
396 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
397 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500398 .surface = {
399 .set_reg = r100_set_surface_reg,
400 .clear_reg = r100_clear_surface_reg,
401 },
Alex Deucher901ea572012-02-23 17:53:39 -0500402 .hpd = {
403 .init = &r100_hpd_init,
404 .fini = &r100_hpd_fini,
405 .sense = &r100_hpd_sense,
406 .set_polarity = &r100_hpd_set_polarity,
407 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500408 .pm = {
409 .misc = &r100_pm_misc,
410 .prepare = &r100_pm_prepare,
411 .finish = &r100_pm_finish,
412 .init_profile = &r100_pm_init_profile,
413 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500414 .get_engine_clock = &radeon_legacy_get_engine_clock,
415 .set_engine_clock = &radeon_legacy_set_engine_clock,
416 .get_memory_clock = &radeon_legacy_get_memory_clock,
417 .set_memory_clock = NULL,
418 .get_pcie_lanes = &rv370_get_pcie_lanes,
419 .set_pcie_lanes = &rv370_set_pcie_lanes,
420 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500421 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500422 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500423 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200424 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500425 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000426};
427
428static struct radeon_asic r300_asic_pcie = {
429 .init = &r300_init,
430 .fini = &r300_fini,
431 .suspend = &r300_suspend,
432 .resume = &r300_resume,
433 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000434 .asic_reset = &r300_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900435 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500436 .gui_idle = &r100_gui_idle,
437 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400438 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500439 .gart = {
440 .tlb_flush = &rv370_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900441 .get_page_entry = &rv370_pcie_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500442 .set_page = &rv370_pcie_gart_set_page,
443 },
Christian König4c87bc22011-10-19 19:02:21 +0200444 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200445 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200446 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500447 .irq = {
448 .set = &r100_irq_set,
449 .process = &r100_irq_process,
450 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500451 .display = {
452 .bandwidth_update = &r100_bandwidth_update,
453 .get_vblank_counter = &r100_get_vblank_counter,
454 .wait_for_vblank = &r100_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400455 .set_backlight_level = &radeon_legacy_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400456 .get_backlight_level = &radeon_legacy_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500457 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500458 .copy = {
459 .blit = &r100_copy_blit,
460 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
461 .dma = &r200_copy_dma,
462 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
463 .copy = &r100_copy_blit,
464 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
465 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500466 .surface = {
467 .set_reg = r100_set_surface_reg,
468 .clear_reg = r100_clear_surface_reg,
469 },
Alex Deucher901ea572012-02-23 17:53:39 -0500470 .hpd = {
471 .init = &r100_hpd_init,
472 .fini = &r100_hpd_fini,
473 .sense = &r100_hpd_sense,
474 .set_polarity = &r100_hpd_set_polarity,
475 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500476 .pm = {
477 .misc = &r100_pm_misc,
478 .prepare = &r100_pm_prepare,
479 .finish = &r100_pm_finish,
480 .init_profile = &r100_pm_init_profile,
481 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500482 .get_engine_clock = &radeon_legacy_get_engine_clock,
483 .set_engine_clock = &radeon_legacy_set_engine_clock,
484 .get_memory_clock = &radeon_legacy_get_memory_clock,
485 .set_memory_clock = NULL,
486 .get_pcie_lanes = &rv370_get_pcie_lanes,
487 .set_pcie_lanes = &rv370_set_pcie_lanes,
488 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500489 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500490 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500491 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200492 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500493 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000494};
495
496static struct radeon_asic r420_asic = {
497 .init = &r420_init,
498 .fini = &r420_fini,
499 .suspend = &r420_suspend,
500 .resume = &r420_resume,
501 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000502 .asic_reset = &r300_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900503 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500504 .gui_idle = &r100_gui_idle,
505 .mc_wait_for_idle = &r300_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400506 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500507 .gart = {
508 .tlb_flush = &rv370_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900509 .get_page_entry = &rv370_pcie_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500510 .set_page = &rv370_pcie_gart_set_page,
511 },
Christian König4c87bc22011-10-19 19:02:21 +0200512 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200513 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200514 },
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,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400523 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400524 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500525 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500526 .copy = {
527 .blit = &r100_copy_blit,
528 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
529 .dma = &r200_copy_dma,
530 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
531 .copy = &r100_copy_blit,
532 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
533 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500534 .surface = {
535 .set_reg = r100_set_surface_reg,
536 .clear_reg = r100_clear_surface_reg,
537 },
Alex Deucher901ea572012-02-23 17:53:39 -0500538 .hpd = {
539 .init = &r100_hpd_init,
540 .fini = &r100_hpd_fini,
541 .sense = &r100_hpd_sense,
542 .set_polarity = &r100_hpd_set_polarity,
543 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500544 .pm = {
545 .misc = &r100_pm_misc,
546 .prepare = &r100_pm_prepare,
547 .finish = &r100_pm_finish,
548 .init_profile = &r420_pm_init_profile,
549 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500550 .get_engine_clock = &radeon_atom_get_engine_clock,
551 .set_engine_clock = &radeon_atom_set_engine_clock,
552 .get_memory_clock = &radeon_atom_get_memory_clock,
553 .set_memory_clock = &radeon_atom_set_memory_clock,
554 .get_pcie_lanes = &rv370_get_pcie_lanes,
555 .set_pcie_lanes = &rv370_set_pcie_lanes,
556 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500557 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500558 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500559 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200560 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500561 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000562};
563
564static struct radeon_asic rs400_asic = {
565 .init = &rs400_init,
566 .fini = &rs400_fini,
567 .suspend = &rs400_suspend,
568 .resume = &rs400_resume,
569 .vga_set_state = &r100_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000570 .asic_reset = &r300_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900571 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500572 .gui_idle = &r100_gui_idle,
573 .mc_wait_for_idle = &rs400_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400574 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500575 .gart = {
576 .tlb_flush = &rs400_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900577 .get_page_entry = &rs400_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500578 .set_page = &rs400_gart_set_page,
579 },
Christian König4c87bc22011-10-19 19:02:21 +0200580 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200581 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200582 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500583 .irq = {
584 .set = &r100_irq_set,
585 .process = &r100_irq_process,
586 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500587 .display = {
588 .bandwidth_update = &r100_bandwidth_update,
589 .get_vblank_counter = &r100_get_vblank_counter,
590 .wait_for_vblank = &r100_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400591 .set_backlight_level = &radeon_legacy_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400592 .get_backlight_level = &radeon_legacy_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500593 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500594 .copy = {
595 .blit = &r100_copy_blit,
596 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
597 .dma = &r200_copy_dma,
598 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
599 .copy = &r100_copy_blit,
600 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
601 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500602 .surface = {
603 .set_reg = r100_set_surface_reg,
604 .clear_reg = r100_clear_surface_reg,
605 },
Alex Deucher901ea572012-02-23 17:53:39 -0500606 .hpd = {
607 .init = &r100_hpd_init,
608 .fini = &r100_hpd_fini,
609 .sense = &r100_hpd_sense,
610 .set_polarity = &r100_hpd_set_polarity,
611 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500612 .pm = {
613 .misc = &r100_pm_misc,
614 .prepare = &r100_pm_prepare,
615 .finish = &r100_pm_finish,
616 .init_profile = &r100_pm_init_profile,
617 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500618 .get_engine_clock = &radeon_legacy_get_engine_clock,
619 .set_engine_clock = &radeon_legacy_set_engine_clock,
620 .get_memory_clock = &radeon_legacy_get_memory_clock,
621 .set_memory_clock = NULL,
622 .get_pcie_lanes = NULL,
623 .set_pcie_lanes = NULL,
624 .set_clock_gating = &radeon_legacy_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500625 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500626 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500627 .page_flip = &r100_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200628 .page_flip_pending = &r100_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500629 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000630};
631
632static struct radeon_asic rs600_asic = {
633 .init = &rs600_init,
634 .fini = &rs600_fini,
635 .suspend = &rs600_suspend,
636 .resume = &rs600_resume,
637 .vga_set_state = &r100_vga_set_state,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000638 .asic_reset = &rs600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900639 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500640 .gui_idle = &r100_gui_idle,
641 .mc_wait_for_idle = &rs600_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400642 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500643 .gart = {
644 .tlb_flush = &rs600_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900645 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500646 .set_page = &rs600_gart_set_page,
647 },
Christian König4c87bc22011-10-19 19:02:21 +0200648 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200649 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200650 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500651 .irq = {
652 .set = &rs600_irq_set,
653 .process = &rs600_irq_process,
654 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500655 .display = {
656 .bandwidth_update = &rs600_bandwidth_update,
657 .get_vblank_counter = &rs600_get_vblank_counter,
658 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400659 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400660 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500661 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500662 .copy = {
663 .blit = &r100_copy_blit,
664 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
665 .dma = &r200_copy_dma,
666 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
667 .copy = &r100_copy_blit,
668 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
669 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500670 .surface = {
671 .set_reg = r100_set_surface_reg,
672 .clear_reg = r100_clear_surface_reg,
673 },
Alex Deucher901ea572012-02-23 17:53:39 -0500674 .hpd = {
675 .init = &rs600_hpd_init,
676 .fini = &rs600_hpd_fini,
677 .sense = &rs600_hpd_sense,
678 .set_polarity = &rs600_hpd_set_polarity,
679 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500680 .pm = {
681 .misc = &rs600_pm_misc,
682 .prepare = &rs600_pm_prepare,
683 .finish = &rs600_pm_finish,
684 .init_profile = &r420_pm_init_profile,
685 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500686 .get_engine_clock = &radeon_atom_get_engine_clock,
687 .set_engine_clock = &radeon_atom_set_engine_clock,
688 .get_memory_clock = &radeon_atom_get_memory_clock,
689 .set_memory_clock = &radeon_atom_set_memory_clock,
690 .get_pcie_lanes = NULL,
691 .set_pcie_lanes = NULL,
692 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500693 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500694 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500695 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200696 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500697 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000698};
699
700static struct radeon_asic rs690_asic = {
701 .init = &rs690_init,
702 .fini = &rs690_fini,
703 .suspend = &rs690_suspend,
704 .resume = &rs690_resume,
705 .vga_set_state = &r100_vga_set_state,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000706 .asic_reset = &rs600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900707 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500708 .gui_idle = &r100_gui_idle,
709 .mc_wait_for_idle = &rs690_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400710 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500711 .gart = {
712 .tlb_flush = &rs400_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900713 .get_page_entry = &rs400_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500714 .set_page = &rs400_gart_set_page,
715 },
Christian König4c87bc22011-10-19 19:02:21 +0200716 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200717 [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200718 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500719 .irq = {
720 .set = &rs600_irq_set,
721 .process = &rs600_irq_process,
722 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500723 .display = {
724 .get_vblank_counter = &rs600_get_vblank_counter,
725 .bandwidth_update = &rs690_bandwidth_update,
726 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400727 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400728 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500729 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500730 .copy = {
731 .blit = &r100_copy_blit,
732 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
733 .dma = &r200_copy_dma,
734 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
735 .copy = &r200_copy_dma,
736 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
737 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500738 .surface = {
739 .set_reg = r100_set_surface_reg,
740 .clear_reg = r100_clear_surface_reg,
741 },
Alex Deucher901ea572012-02-23 17:53:39 -0500742 .hpd = {
743 .init = &rs600_hpd_init,
744 .fini = &rs600_hpd_fini,
745 .sense = &rs600_hpd_sense,
746 .set_polarity = &rs600_hpd_set_polarity,
747 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500748 .pm = {
749 .misc = &rs600_pm_misc,
750 .prepare = &rs600_pm_prepare,
751 .finish = &rs600_pm_finish,
752 .init_profile = &r420_pm_init_profile,
753 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500754 .get_engine_clock = &radeon_atom_get_engine_clock,
755 .set_engine_clock = &radeon_atom_set_engine_clock,
756 .get_memory_clock = &radeon_atom_get_memory_clock,
757 .set_memory_clock = &radeon_atom_set_memory_clock,
758 .get_pcie_lanes = NULL,
759 .set_pcie_lanes = NULL,
760 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500761 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500762 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500763 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200764 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500765 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000766};
767
768static struct radeon_asic rv515_asic = {
769 .init = &rv515_init,
770 .fini = &rv515_fini,
771 .suspend = &rv515_suspend,
772 .resume = &rv515_resume,
773 .vga_set_state = &r100_vga_set_state,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000774 .asic_reset = &rs600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900775 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500776 .gui_idle = &r100_gui_idle,
777 .mc_wait_for_idle = &rv515_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400778 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500779 .gart = {
780 .tlb_flush = &rv370_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900781 .get_page_entry = &rv370_pcie_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500782 .set_page = &rv370_pcie_gart_set_page,
783 },
Christian König4c87bc22011-10-19 19:02:21 +0200784 .ring = {
Alex Deucherd8a74e12015-01-15 10:52:33 -0500785 [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200786 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500787 .irq = {
788 .set = &rs600_irq_set,
789 .process = &rs600_irq_process,
790 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500791 .display = {
792 .get_vblank_counter = &rs600_get_vblank_counter,
793 .bandwidth_update = &rv515_bandwidth_update,
794 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400795 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400796 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500797 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500798 .copy = {
799 .blit = &r100_copy_blit,
800 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
801 .dma = &r200_copy_dma,
802 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
803 .copy = &r100_copy_blit,
804 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
805 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500806 .surface = {
807 .set_reg = r100_set_surface_reg,
808 .clear_reg = r100_clear_surface_reg,
809 },
Alex Deucher901ea572012-02-23 17:53:39 -0500810 .hpd = {
811 .init = &rs600_hpd_init,
812 .fini = &rs600_hpd_fini,
813 .sense = &rs600_hpd_sense,
814 .set_polarity = &rs600_hpd_set_polarity,
815 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500816 .pm = {
817 .misc = &rs600_pm_misc,
818 .prepare = &rs600_pm_prepare,
819 .finish = &rs600_pm_finish,
820 .init_profile = &r420_pm_init_profile,
821 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500822 .get_engine_clock = &radeon_atom_get_engine_clock,
823 .set_engine_clock = &radeon_atom_set_engine_clock,
824 .get_memory_clock = &radeon_atom_get_memory_clock,
825 .set_memory_clock = &radeon_atom_set_memory_clock,
826 .get_pcie_lanes = &rv370_get_pcie_lanes,
827 .set_pcie_lanes = &rv370_set_pcie_lanes,
828 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500829 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500830 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500831 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200832 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500833 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000834};
835
836static struct radeon_asic r520_asic = {
837 .init = &r520_init,
838 .fini = &rv515_fini,
839 .suspend = &rv515_suspend,
840 .resume = &r520_resume,
841 .vga_set_state = &r100_vga_set_state,
Jerome Glisse90aca4d2010-03-09 14:45:12 +0000842 .asic_reset = &rs600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900843 .mmio_hdp_flush = NULL,
Alex Deucher54e88e02012-02-23 18:10:29 -0500844 .gui_idle = &r100_gui_idle,
845 .mc_wait_for_idle = &r520_mc_wait_for_idle,
Alex Deucher18b53e92014-10-01 09:25:27 -0400846 .get_allowed_info_register = radeon_invalid_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500847 .gart = {
848 .tlb_flush = &rv370_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900849 .get_page_entry = &rv370_pcie_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500850 .set_page = &rv370_pcie_gart_set_page,
851 },
Christian König4c87bc22011-10-19 19:02:21 +0200852 .ring = {
Alex Deucherd8a74e12015-01-15 10:52:33 -0500853 [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
Christian König4c87bc22011-10-19 19:02:21 +0200854 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500855 .irq = {
856 .set = &rs600_irq_set,
857 .process = &rs600_irq_process,
858 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500859 .display = {
860 .bandwidth_update = &rv515_bandwidth_update,
861 .get_vblank_counter = &rs600_get_vblank_counter,
862 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400863 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400864 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500865 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500866 .copy = {
867 .blit = &r100_copy_blit,
868 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
869 .dma = &r200_copy_dma,
870 .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
871 .copy = &r100_copy_blit,
872 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
873 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500874 .surface = {
875 .set_reg = r100_set_surface_reg,
876 .clear_reg = r100_clear_surface_reg,
877 },
Alex Deucher901ea572012-02-23 17:53:39 -0500878 .hpd = {
879 .init = &rs600_hpd_init,
880 .fini = &rs600_hpd_fini,
881 .sense = &rs600_hpd_sense,
882 .set_polarity = &rs600_hpd_set_polarity,
883 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500884 .pm = {
885 .misc = &rs600_pm_misc,
886 .prepare = &rs600_pm_prepare,
887 .finish = &rs600_pm_finish,
888 .init_profile = &r420_pm_init_profile,
889 .get_dynpm_state = &r100_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500890 .get_engine_clock = &radeon_atom_get_engine_clock,
891 .set_engine_clock = &radeon_atom_set_engine_clock,
892 .get_memory_clock = &radeon_atom_get_memory_clock,
893 .set_memory_clock = &radeon_atom_set_memory_clock,
894 .get_pcie_lanes = &rv370_get_pcie_lanes,
895 .set_pcie_lanes = &rv370_set_pcie_lanes,
896 .set_clock_gating = &radeon_atom_set_clock_gating,
Alex Deuchera02fa392012-02-23 17:53:41 -0500897 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500898 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500899 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200900 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500901 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000902};
903
Julia Lawalld26678d2015-11-29 17:12:41 +0100904static const struct radeon_asic_ring r600_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +0200905 .ib_execute = &r600_ring_ib_execute,
906 .emit_fence = &r600_fence_ring_emit,
907 .emit_semaphore = &r600_semaphore_ring_emit,
908 .cs_parse = &r600_cs_parse,
909 .ring_test = &r600_ring_test,
910 .ib_test = &r600_ib_test,
911 .is_lockup = &r600_gfx_is_lockup,
Alex Deucherea31bf62013-12-09 19:44:30 -0500912 .get_rptr = &r600_gfx_get_rptr,
913 .get_wptr = &r600_gfx_get_wptr,
914 .set_wptr = &r600_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +0200915};
916
Julia Lawalld26678d2015-11-29 17:12:41 +0100917static const struct radeon_asic_ring r600_dma_ring = {
Christian König76a0df82013-08-13 11:56:50 +0200918 .ib_execute = &r600_dma_ring_ib_execute,
919 .emit_fence = &r600_dma_fence_ring_emit,
920 .emit_semaphore = &r600_dma_semaphore_ring_emit,
921 .cs_parse = &r600_dma_cs_parse,
922 .ring_test = &r600_dma_ring_test,
923 .ib_test = &r600_dma_ib_test,
924 .is_lockup = &r600_dma_is_lockup,
Christian König2e1e6da2013-08-13 11:56:52 +0200925 .get_rptr = &r600_dma_get_rptr,
926 .get_wptr = &r600_dma_get_wptr,
927 .set_wptr = &r600_dma_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +0200928};
929
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000930static struct radeon_asic r600_asic = {
931 .init = &r600_init,
932 .fini = &r600_fini,
933 .suspend = &r600_suspend,
934 .resume = &r600_resume,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +0000935 .vga_set_state = &r600_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +0000936 .asic_reset = &r600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +0900937 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -0500938 .gui_idle = &r600_gui_idle,
939 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -0500940 .get_xclk = &r600_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -0500941 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherc6d2ac22014-10-01 09:36:57 -0400942 .get_allowed_info_register = r600_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500943 .gart = {
944 .tlb_flush = &r600_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +0900945 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -0500946 .set_page = &rs600_gart_set_page,
947 },
Christian König4c87bc22011-10-19 19:02:21 +0200948 .ring = {
Christian König76a0df82013-08-13 11:56:50 +0200949 [RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
950 [R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
Christian König4c87bc22011-10-19 19:02:21 +0200951 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -0500952 .irq = {
953 .set = &r600_irq_set,
954 .process = &r600_irq_process,
955 },
Alex Deucherc79a49c2012-02-23 17:53:47 -0500956 .display = {
957 .bandwidth_update = &rv515_bandwidth_update,
958 .get_vblank_counter = &rs600_get_vblank_counter,
959 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -0400960 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -0400961 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -0500962 },
Alex Deucher27cd7762012-02-23 17:53:42 -0500963 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -0400964 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -0500965 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher4d756582012-09-27 15:08:35 -0400966 .dma = &r600_copy_dma,
967 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucherbfea6a62013-07-11 14:53:34 -0400968 .copy = &r600_copy_cpdma,
Alex Deucheraeea40c2013-07-11 14:20:11 -0400969 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -0500970 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -0500971 .surface = {
972 .set_reg = r600_set_surface_reg,
973 .clear_reg = r600_clear_surface_reg,
974 },
Alex Deucher901ea572012-02-23 17:53:39 -0500975 .hpd = {
976 .init = &r600_hpd_init,
977 .fini = &r600_hpd_fini,
978 .sense = &r600_hpd_sense,
979 .set_polarity = &r600_hpd_set_polarity,
980 },
Alex Deuchera02fa392012-02-23 17:53:41 -0500981 .pm = {
982 .misc = &r600_pm_misc,
983 .prepare = &rs600_pm_prepare,
984 .finish = &rs600_pm_finish,
985 .init_profile = &r600_pm_init_profile,
986 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -0500987 .get_engine_clock = &radeon_atom_get_engine_clock,
988 .set_engine_clock = &radeon_atom_set_engine_clock,
989 .get_memory_clock = &radeon_atom_get_memory_clock,
990 .set_memory_clock = &radeon_atom_set_memory_clock,
991 .get_pcie_lanes = &r600_get_pcie_lanes,
992 .set_pcie_lanes = &r600_set_pcie_lanes,
993 .set_clock_gating = NULL,
Alex Deucher6bd1c382013-06-21 14:38:03 -0400994 .get_temperature = &rv6xx_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -0500995 },
Alex Deucher0f9e0062012-02-23 17:53:40 -0500996 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -0500997 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +0200998 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -0500999 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001000};
1001
Julia Lawalld26678d2015-11-29 17:12:41 +01001002static const struct radeon_asic_ring rv6xx_uvd_ring = {
Christian König856754c2013-04-16 22:11:22 +02001003 .ib_execute = &uvd_v1_0_ib_execute,
1004 .emit_fence = &uvd_v1_0_fence_emit,
1005 .emit_semaphore = &uvd_v1_0_semaphore_emit,
1006 .cs_parse = &radeon_uvd_cs_parse,
1007 .ring_test = &uvd_v1_0_ring_test,
1008 .ib_test = &uvd_v1_0_ib_test,
1009 .is_lockup = &radeon_ring_test_lockup,
1010 .get_rptr = &uvd_v1_0_get_rptr,
1011 .get_wptr = &uvd_v1_0_get_wptr,
1012 .set_wptr = &uvd_v1_0_set_wptr,
1013};
1014
Alex Deucherca361b62013-06-21 14:42:08 -04001015static struct radeon_asic rv6xx_asic = {
1016 .init = &r600_init,
1017 .fini = &r600_fini,
1018 .suspend = &r600_suspend,
1019 .resume = &r600_resume,
1020 .vga_set_state = &r600_vga_set_state,
1021 .asic_reset = &r600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +09001022 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucherca361b62013-06-21 14:42:08 -04001023 .gui_idle = &r600_gui_idle,
1024 .mc_wait_for_idle = &r600_mc_wait_for_idle,
1025 .get_xclk = &r600_get_xclk,
1026 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherc6d2ac22014-10-01 09:36:57 -04001027 .get_allowed_info_register = r600_get_allowed_info_register,
Alex Deucherca361b62013-06-21 14:42:08 -04001028 .gart = {
1029 .tlb_flush = &r600_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001030 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherca361b62013-06-21 14:42:08 -04001031 .set_page = &rs600_gart_set_page,
1032 },
1033 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001034 [RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
1035 [R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
Christian König856754c2013-04-16 22:11:22 +02001036 [R600_RING_TYPE_UVD_INDEX] = &rv6xx_uvd_ring,
Alex Deucherca361b62013-06-21 14:42:08 -04001037 },
1038 .irq = {
1039 .set = &r600_irq_set,
1040 .process = &r600_irq_process,
1041 },
1042 .display = {
1043 .bandwidth_update = &rv515_bandwidth_update,
1044 .get_vblank_counter = &rs600_get_vblank_counter,
1045 .wait_for_vblank = &avivo_wait_for_vblank,
1046 .set_backlight_level = &atombios_set_backlight_level,
1047 .get_backlight_level = &atombios_get_backlight_level,
1048 },
1049 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001050 .blit = &r600_copy_cpdma,
Alex Deucherca361b62013-06-21 14:42:08 -04001051 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1052 .dma = &r600_copy_dma,
1053 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucherbfea6a62013-07-11 14:53:34 -04001054 .copy = &r600_copy_cpdma,
Alex Deucheraeea40c2013-07-11 14:20:11 -04001055 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucherca361b62013-06-21 14:42:08 -04001056 },
1057 .surface = {
1058 .set_reg = r600_set_surface_reg,
1059 .clear_reg = r600_clear_surface_reg,
1060 },
1061 .hpd = {
1062 .init = &r600_hpd_init,
1063 .fini = &r600_hpd_fini,
1064 .sense = &r600_hpd_sense,
1065 .set_polarity = &r600_hpd_set_polarity,
1066 },
1067 .pm = {
1068 .misc = &r600_pm_misc,
1069 .prepare = &rs600_pm_prepare,
1070 .finish = &rs600_pm_finish,
1071 .init_profile = &r600_pm_init_profile,
1072 .get_dynpm_state = &r600_pm_get_dynpm_state,
1073 .get_engine_clock = &radeon_atom_get_engine_clock,
1074 .set_engine_clock = &radeon_atom_set_engine_clock,
1075 .get_memory_clock = &radeon_atom_get_memory_clock,
1076 .set_memory_clock = &radeon_atom_set_memory_clock,
1077 .get_pcie_lanes = &r600_get_pcie_lanes,
1078 .set_pcie_lanes = &r600_set_pcie_lanes,
1079 .set_clock_gating = NULL,
1080 .get_temperature = &rv6xx_get_temp,
Alex Deucher1b9ba702013-09-05 09:52:37 -04001081 .set_uvd_clocks = &r600_set_uvd_clocks,
Alex Deucherca361b62013-06-21 14:42:08 -04001082 },
Alex Deucher4a6369e2013-04-12 14:04:10 -04001083 .dpm = {
1084 .init = &rv6xx_dpm_init,
1085 .setup_asic = &rv6xx_setup_asic,
1086 .enable = &rv6xx_dpm_enable,
Alex Deuchera4643ba2013-12-19 12:18:13 -05001087 .late_enable = &r600_dpm_late_enable,
Alex Deucher4a6369e2013-04-12 14:04:10 -04001088 .disable = &rv6xx_dpm_disable,
Alex Deucher98243912013-01-16 13:13:42 -05001089 .pre_set_power_state = &r600_dpm_pre_set_power_state,
Alex Deucher4a6369e2013-04-12 14:04:10 -04001090 .set_power_state = &rv6xx_dpm_set_power_state,
Alex Deucher98243912013-01-16 13:13:42 -05001091 .post_set_power_state = &r600_dpm_post_set_power_state,
Alex Deucher4a6369e2013-04-12 14:04:10 -04001092 .display_configuration_changed = &rv6xx_dpm_display_configuration_changed,
1093 .fini = &rv6xx_dpm_fini,
1094 .get_sclk = &rv6xx_dpm_get_sclk,
1095 .get_mclk = &rv6xx_dpm_get_mclk,
1096 .print_power_state = &rv6xx_dpm_print_power_state,
Alex Deucher242916a2013-06-28 14:20:53 -04001097 .debugfs_print_current_performance_level = &rv6xx_dpm_debugfs_print_current_performance_level,
Alex Deucherf4f85a82013-07-25 20:07:25 -04001098 .force_performance_level = &rv6xx_dpm_force_performance_level,
Alex Deucherd0a04d32014-09-30 10:27:42 -04001099 .get_current_sclk = &rv6xx_dpm_get_current_sclk,
1100 .get_current_mclk = &rv6xx_dpm_get_current_mclk,
Alex Deucher4a6369e2013-04-12 14:04:10 -04001101 },
Alex Deucherca361b62013-06-21 14:42:08 -04001102 .pflip = {
Alex Deucherca361b62013-06-21 14:42:08 -04001103 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001104 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucherca361b62013-06-21 14:42:08 -04001105 },
1106};
1107
Alex Deucherf47299c2010-03-16 20:54:38 -04001108static struct radeon_asic rs780_asic = {
1109 .init = &r600_init,
1110 .fini = &r600_fini,
1111 .suspend = &r600_suspend,
1112 .resume = &r600_resume,
Alex Deucherf47299c2010-03-16 20:54:38 -04001113 .vga_set_state = &r600_vga_set_state,
Jerome Glissea2d07b72010-03-09 14:45:11 +00001114 .asic_reset = &r600_asic_reset,
Michel Dänzer124764f2014-07-31 18:43:48 +09001115 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001116 .gui_idle = &r600_gui_idle,
1117 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001118 .get_xclk = &r600_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001119 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherc6d2ac22014-10-01 09:36:57 -04001120 .get_allowed_info_register = r600_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001121 .gart = {
1122 .tlb_flush = &r600_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001123 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001124 .set_page = &rs600_gart_set_page,
1125 },
Christian König4c87bc22011-10-19 19:02:21 +02001126 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001127 [RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
1128 [R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
Christian König856754c2013-04-16 22:11:22 +02001129 [R600_RING_TYPE_UVD_INDEX] = &rv6xx_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001130 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001131 .irq = {
1132 .set = &r600_irq_set,
1133 .process = &r600_irq_process,
1134 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001135 .display = {
1136 .bandwidth_update = &rs690_bandwidth_update,
1137 .get_vblank_counter = &rs600_get_vblank_counter,
1138 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001139 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001140 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001141 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001142 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001143 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001144 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher4d756582012-09-27 15:08:35 -04001145 .dma = &r600_copy_dma,
1146 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucherbfea6a62013-07-11 14:53:34 -04001147 .copy = &r600_copy_cpdma,
Alex Deucheraeea40c2013-07-11 14:20:11 -04001148 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001149 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001150 .surface = {
1151 .set_reg = r600_set_surface_reg,
1152 .clear_reg = r600_clear_surface_reg,
1153 },
Alex Deucher901ea572012-02-23 17:53:39 -05001154 .hpd = {
1155 .init = &r600_hpd_init,
1156 .fini = &r600_hpd_fini,
1157 .sense = &r600_hpd_sense,
1158 .set_polarity = &r600_hpd_set_polarity,
1159 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001160 .pm = {
1161 .misc = &r600_pm_misc,
1162 .prepare = &rs600_pm_prepare,
1163 .finish = &rs600_pm_finish,
1164 .init_profile = &rs780_pm_init_profile,
1165 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001166 .get_engine_clock = &radeon_atom_get_engine_clock,
1167 .set_engine_clock = &radeon_atom_set_engine_clock,
1168 .get_memory_clock = NULL,
1169 .set_memory_clock = NULL,
1170 .get_pcie_lanes = NULL,
1171 .set_pcie_lanes = NULL,
1172 .set_clock_gating = NULL,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001173 .get_temperature = &rv6xx_get_temp,
Alex Deucher1b9ba702013-09-05 09:52:37 -04001174 .set_uvd_clocks = &r600_set_uvd_clocks,
Alex Deuchera02fa392012-02-23 17:53:41 -05001175 },
Alex Deucher9d670062013-04-12 13:59:22 -04001176 .dpm = {
1177 .init = &rs780_dpm_init,
1178 .setup_asic = &rs780_dpm_setup_asic,
1179 .enable = &rs780_dpm_enable,
Alex Deuchera4643ba2013-12-19 12:18:13 -05001180 .late_enable = &r600_dpm_late_enable,
Alex Deucher9d670062013-04-12 13:59:22 -04001181 .disable = &rs780_dpm_disable,
Alex Deucher98243912013-01-16 13:13:42 -05001182 .pre_set_power_state = &r600_dpm_pre_set_power_state,
Alex Deucher9d670062013-04-12 13:59:22 -04001183 .set_power_state = &rs780_dpm_set_power_state,
Alex Deucher98243912013-01-16 13:13:42 -05001184 .post_set_power_state = &r600_dpm_post_set_power_state,
Alex Deucher9d670062013-04-12 13:59:22 -04001185 .display_configuration_changed = &rs780_dpm_display_configuration_changed,
1186 .fini = &rs780_dpm_fini,
1187 .get_sclk = &rs780_dpm_get_sclk,
1188 .get_mclk = &rs780_dpm_get_mclk,
1189 .print_power_state = &rs780_dpm_print_power_state,
Alex Deucher444bddc2013-07-02 13:05:23 -04001190 .debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level,
Anthoine Bourgeois63580c32013-09-03 13:52:19 -04001191 .force_performance_level = &rs780_dpm_force_performance_level,
Alex Deucher3c945662014-09-30 10:19:57 -04001192 .get_current_sclk = &rs780_dpm_get_current_sclk,
1193 .get_current_mclk = &rs780_dpm_get_current_mclk,
Alex Deucher9d670062013-04-12 13:59:22 -04001194 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001195 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001196 .page_flip = &rs600_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001197 .page_flip_pending = &rs600_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001198 },
Alex Deucherf47299c2010-03-16 20:54:38 -04001199};
1200
Julia Lawalld26678d2015-11-29 17:12:41 +01001201static const struct radeon_asic_ring rv770_uvd_ring = {
Christian Könige409b122013-08-13 11:56:53 +02001202 .ib_execute = &uvd_v1_0_ib_execute,
1203 .emit_fence = &uvd_v2_2_fence_emit,
Christian König013ead42015-05-01 12:34:12 +02001204 .emit_semaphore = &uvd_v2_2_semaphore_emit,
Christian König76a0df82013-08-13 11:56:50 +02001205 .cs_parse = &radeon_uvd_cs_parse,
Christian Könige409b122013-08-13 11:56:53 +02001206 .ring_test = &uvd_v1_0_ring_test,
1207 .ib_test = &uvd_v1_0_ib_test,
Christian König76a0df82013-08-13 11:56:50 +02001208 .is_lockup = &radeon_ring_test_lockup,
Christian Könige409b122013-08-13 11:56:53 +02001209 .get_rptr = &uvd_v1_0_get_rptr,
1210 .get_wptr = &uvd_v1_0_get_wptr,
1211 .set_wptr = &uvd_v1_0_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001212};
1213
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001214static struct radeon_asic rv770_asic = {
1215 .init = &rv770_init,
1216 .fini = &rv770_fini,
1217 .suspend = &rv770_suspend,
1218 .resume = &rv770_resume,
Jerome Glissea2d07b72010-03-09 14:45:11 +00001219 .asic_reset = &r600_asic_reset,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001220 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001221 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001222 .gui_idle = &r600_gui_idle,
1223 .mc_wait_for_idle = &r600_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001224 .get_xclk = &rv770_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001225 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherc6d2ac22014-10-01 09:36:57 -04001226 .get_allowed_info_register = r600_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001227 .gart = {
1228 .tlb_flush = &r600_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001229 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001230 .set_page = &rs600_gart_set_page,
1231 },
Christian König4c87bc22011-10-19 19:02:21 +02001232 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001233 [RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
1234 [R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
1235 [R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001236 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001237 .irq = {
1238 .set = &r600_irq_set,
1239 .process = &r600_irq_process,
1240 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001241 .display = {
1242 .bandwidth_update = &rv515_bandwidth_update,
1243 .get_vblank_counter = &rs600_get_vblank_counter,
1244 .wait_for_vblank = &avivo_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001245 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001246 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001247 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001248 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001249 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001250 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher43fb7782013-01-04 09:24:18 -05001251 .dma = &rv770_copy_dma,
Alex Deucher4d756582012-09-27 15:08:35 -04001252 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher43fb7782013-01-04 09:24:18 -05001253 .copy = &rv770_copy_dma,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001254 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001255 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001256 .surface = {
1257 .set_reg = r600_set_surface_reg,
1258 .clear_reg = r600_clear_surface_reg,
1259 },
Alex Deucher901ea572012-02-23 17:53:39 -05001260 .hpd = {
1261 .init = &r600_hpd_init,
1262 .fini = &r600_hpd_fini,
1263 .sense = &r600_hpd_sense,
1264 .set_polarity = &r600_hpd_set_polarity,
1265 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001266 .pm = {
1267 .misc = &rv770_pm_misc,
1268 .prepare = &rs600_pm_prepare,
1269 .finish = &rs600_pm_finish,
1270 .init_profile = &r600_pm_init_profile,
1271 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001272 .get_engine_clock = &radeon_atom_get_engine_clock,
1273 .set_engine_clock = &radeon_atom_set_engine_clock,
1274 .get_memory_clock = &radeon_atom_get_memory_clock,
1275 .set_memory_clock = &radeon_atom_set_memory_clock,
1276 .get_pcie_lanes = &r600_get_pcie_lanes,
1277 .set_pcie_lanes = &r600_set_pcie_lanes,
1278 .set_clock_gating = &radeon_atom_set_clock_gating,
Christian Königef0e6e62013-04-08 12:41:35 +02001279 .set_uvd_clocks = &rv770_set_uvd_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001280 .get_temperature = &rv770_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -05001281 },
Alex Deucher66229b22013-06-26 00:11:19 -04001282 .dpm = {
1283 .init = &rv770_dpm_init,
1284 .setup_asic = &rv770_dpm_setup_asic,
1285 .enable = &rv770_dpm_enable,
Alex Deuchera3f11242013-12-19 13:48:36 -05001286 .late_enable = &rv770_dpm_late_enable,
Alex Deucher66229b22013-06-26 00:11:19 -04001287 .disable = &rv770_dpm_disable,
Alex Deucher98243912013-01-16 13:13:42 -05001288 .pre_set_power_state = &r600_dpm_pre_set_power_state,
Alex Deucher66229b22013-06-26 00:11:19 -04001289 .set_power_state = &rv770_dpm_set_power_state,
Alex Deucher98243912013-01-16 13:13:42 -05001290 .post_set_power_state = &r600_dpm_post_set_power_state,
Alex Deucher66229b22013-06-26 00:11:19 -04001291 .display_configuration_changed = &rv770_dpm_display_configuration_changed,
1292 .fini = &rv770_dpm_fini,
1293 .get_sclk = &rv770_dpm_get_sclk,
1294 .get_mclk = &rv770_dpm_get_mclk,
1295 .print_power_state = &rv770_dpm_print_power_state,
Alex Deucherbd210d12013-06-28 10:06:26 -04001296 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
Alex Deucher8b5e6b72013-07-02 18:40:35 -04001297 .force_performance_level = &rv770_dpm_force_performance_level,
Alex Deucherb06195d2013-07-08 11:49:48 -04001298 .vblank_too_short = &rv770_dpm_vblank_too_short,
Alex Deucher296deb72014-09-30 10:34:39 -04001299 .get_current_sclk = &rv770_dpm_get_current_sclk,
1300 .get_current_mclk = &rv770_dpm_get_current_mclk,
Alex Deucher66229b22013-06-26 00:11:19 -04001301 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001302 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001303 .page_flip = &rv770_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001304 .page_flip_pending = &rv770_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001305 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001306};
1307
Julia Lawalld26678d2015-11-29 17:12:41 +01001308static const struct radeon_asic_ring evergreen_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001309 .ib_execute = &evergreen_ring_ib_execute,
1310 .emit_fence = &r600_fence_ring_emit,
1311 .emit_semaphore = &r600_semaphore_ring_emit,
1312 .cs_parse = &evergreen_cs_parse,
1313 .ring_test = &r600_ring_test,
1314 .ib_test = &r600_ib_test,
1315 .is_lockup = &evergreen_gfx_is_lockup,
Alex Deucherea31bf62013-12-09 19:44:30 -05001316 .get_rptr = &r600_gfx_get_rptr,
1317 .get_wptr = &r600_gfx_get_wptr,
1318 .set_wptr = &r600_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001319};
1320
Julia Lawalld26678d2015-11-29 17:12:41 +01001321static const struct radeon_asic_ring evergreen_dma_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001322 .ib_execute = &evergreen_dma_ring_ib_execute,
1323 .emit_fence = &evergreen_dma_fence_ring_emit,
1324 .emit_semaphore = &r600_dma_semaphore_ring_emit,
1325 .cs_parse = &evergreen_dma_cs_parse,
1326 .ring_test = &r600_dma_ring_test,
1327 .ib_test = &r600_dma_ib_test,
1328 .is_lockup = &evergreen_dma_is_lockup,
Christian König2e1e6da2013-08-13 11:56:52 +02001329 .get_rptr = &r600_dma_get_rptr,
1330 .get_wptr = &r600_dma_get_wptr,
1331 .set_wptr = &r600_dma_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001332};
1333
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001334static struct radeon_asic evergreen_asic = {
1335 .init = &evergreen_init,
1336 .fini = &evergreen_fini,
1337 .suspend = &evergreen_suspend,
1338 .resume = &evergreen_resume,
Jerome Glissea2d07b72010-03-09 14:45:11 +00001339 .asic_reset = &evergreen_asic_reset,
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001340 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001341 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001342 .gui_idle = &r600_gui_idle,
1343 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001344 .get_xclk = &rv770_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001345 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherff609972014-10-01 09:43:38 -04001346 .get_allowed_info_register = evergreen_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001347 .gart = {
1348 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001349 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001350 .set_page = &rs600_gart_set_page,
1351 },
Christian König4c87bc22011-10-19 19:02:21 +02001352 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001353 [RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
1354 [R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
1355 [R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001356 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001357 .irq = {
1358 .set = &evergreen_irq_set,
1359 .process = &evergreen_irq_process,
1360 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001361 .display = {
1362 .bandwidth_update = &evergreen_bandwidth_update,
1363 .get_vblank_counter = &evergreen_get_vblank_counter,
1364 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001365 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001366 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001367 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001368 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001369 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001370 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher233d1ad2012-12-04 15:25:59 -05001371 .dma = &evergreen_copy_dma,
1372 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001373 .copy = &evergreen_copy_dma,
1374 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001375 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001376 .surface = {
1377 .set_reg = r600_set_surface_reg,
1378 .clear_reg = r600_clear_surface_reg,
1379 },
Alex Deucher901ea572012-02-23 17:53:39 -05001380 .hpd = {
1381 .init = &evergreen_hpd_init,
1382 .fini = &evergreen_hpd_fini,
1383 .sense = &evergreen_hpd_sense,
1384 .set_polarity = &evergreen_hpd_set_polarity,
1385 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001386 .pm = {
1387 .misc = &evergreen_pm_misc,
1388 .prepare = &evergreen_pm_prepare,
1389 .finish = &evergreen_pm_finish,
1390 .init_profile = &r600_pm_init_profile,
1391 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001392 .get_engine_clock = &radeon_atom_get_engine_clock,
1393 .set_engine_clock = &radeon_atom_set_engine_clock,
1394 .get_memory_clock = &radeon_atom_get_memory_clock,
1395 .set_memory_clock = &radeon_atom_set_memory_clock,
1396 .get_pcie_lanes = &r600_get_pcie_lanes,
1397 .set_pcie_lanes = &r600_set_pcie_lanes,
1398 .set_clock_gating = NULL,
Alex Deuchera8b49252013-04-08 12:41:33 +02001399 .set_uvd_clocks = &evergreen_set_uvd_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001400 .get_temperature = &evergreen_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -05001401 },
Alex Deucherdc50ba72013-06-26 00:33:35 -04001402 .dpm = {
1403 .init = &cypress_dpm_init,
1404 .setup_asic = &cypress_dpm_setup_asic,
1405 .enable = &cypress_dpm_enable,
Alex Deuchera3f11242013-12-19 13:48:36 -05001406 .late_enable = &rv770_dpm_late_enable,
Alex Deucherdc50ba72013-06-26 00:33:35 -04001407 .disable = &cypress_dpm_disable,
Alex Deucher98243912013-01-16 13:13:42 -05001408 .pre_set_power_state = &r600_dpm_pre_set_power_state,
Alex Deucherdc50ba72013-06-26 00:33:35 -04001409 .set_power_state = &cypress_dpm_set_power_state,
Alex Deucher98243912013-01-16 13:13:42 -05001410 .post_set_power_state = &r600_dpm_post_set_power_state,
Alex Deucherdc50ba72013-06-26 00:33:35 -04001411 .display_configuration_changed = &cypress_dpm_display_configuration_changed,
1412 .fini = &cypress_dpm_fini,
1413 .get_sclk = &rv770_dpm_get_sclk,
1414 .get_mclk = &rv770_dpm_get_mclk,
1415 .print_power_state = &rv770_dpm_print_power_state,
Alex Deucherbd210d12013-06-28 10:06:26 -04001416 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
Alex Deucher8b5e6b72013-07-02 18:40:35 -04001417 .force_performance_level = &rv770_dpm_force_performance_level,
Alex Deucherd0b54bd2013-07-08 11:56:09 -04001418 .vblank_too_short = &cypress_dpm_vblank_too_short,
Alex Deucher296deb72014-09-30 10:34:39 -04001419 .get_current_sclk = &rv770_dpm_get_current_sclk,
1420 .get_current_mclk = &rv770_dpm_get_current_mclk,
Alex Deucherdc50ba72013-06-26 00:33:35 -04001421 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001422 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001423 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001424 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001425 },
Daniel Vetter48e7a5f2010-03-11 21:19:15 +00001426};
1427
Alex Deucher958261d2010-11-22 17:56:30 -05001428static struct radeon_asic sumo_asic = {
1429 .init = &evergreen_init,
1430 .fini = &evergreen_fini,
1431 .suspend = &evergreen_suspend,
1432 .resume = &evergreen_resume,
Alex Deucher958261d2010-11-22 17:56:30 -05001433 .asic_reset = &evergreen_asic_reset,
1434 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001435 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001436 .gui_idle = &r600_gui_idle,
1437 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001438 .get_xclk = &r600_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001439 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherff609972014-10-01 09:43:38 -04001440 .get_allowed_info_register = evergreen_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001441 .gart = {
1442 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001443 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001444 .set_page = &rs600_gart_set_page,
1445 },
Christian König4c87bc22011-10-19 19:02:21 +02001446 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001447 [RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
1448 [R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
1449 [R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001450 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001451 .irq = {
1452 .set = &evergreen_irq_set,
1453 .process = &evergreen_irq_process,
1454 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001455 .display = {
1456 .bandwidth_update = &evergreen_bandwidth_update,
1457 .get_vblank_counter = &evergreen_get_vblank_counter,
1458 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001459 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001460 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001461 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001462 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001463 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001464 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher233d1ad2012-12-04 15:25:59 -05001465 .dma = &evergreen_copy_dma,
1466 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001467 .copy = &evergreen_copy_dma,
1468 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001469 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001470 .surface = {
1471 .set_reg = r600_set_surface_reg,
1472 .clear_reg = r600_clear_surface_reg,
1473 },
Alex Deucher901ea572012-02-23 17:53:39 -05001474 .hpd = {
1475 .init = &evergreen_hpd_init,
1476 .fini = &evergreen_hpd_fini,
1477 .sense = &evergreen_hpd_sense,
1478 .set_polarity = &evergreen_hpd_set_polarity,
1479 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001480 .pm = {
1481 .misc = &evergreen_pm_misc,
1482 .prepare = &evergreen_pm_prepare,
1483 .finish = &evergreen_pm_finish,
1484 .init_profile = &sumo_pm_init_profile,
1485 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001486 .get_engine_clock = &radeon_atom_get_engine_clock,
1487 .set_engine_clock = &radeon_atom_set_engine_clock,
1488 .get_memory_clock = NULL,
1489 .set_memory_clock = NULL,
1490 .get_pcie_lanes = NULL,
1491 .set_pcie_lanes = NULL,
1492 .set_clock_gating = NULL,
Alex Deucher23d33ba2013-04-08 12:41:32 +02001493 .set_uvd_clocks = &sumo_set_uvd_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001494 .get_temperature = &sumo_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -05001495 },
Alex Deucher80ea2c12013-04-12 14:56:21 -04001496 .dpm = {
1497 .init = &sumo_dpm_init,
1498 .setup_asic = &sumo_dpm_setup_asic,
1499 .enable = &sumo_dpm_enable,
Alex Deucher14ec9fa2013-12-19 11:56:52 -05001500 .late_enable = &sumo_dpm_late_enable,
Alex Deucher80ea2c12013-04-12 14:56:21 -04001501 .disable = &sumo_dpm_disable,
Alex Deucher422a56b2013-06-25 15:40:21 -04001502 .pre_set_power_state = &sumo_dpm_pre_set_power_state,
Alex Deucher80ea2c12013-04-12 14:56:21 -04001503 .set_power_state = &sumo_dpm_set_power_state,
Alex Deucher422a56b2013-06-25 15:40:21 -04001504 .post_set_power_state = &sumo_dpm_post_set_power_state,
Alex Deucher80ea2c12013-04-12 14:56:21 -04001505 .display_configuration_changed = &sumo_dpm_display_configuration_changed,
1506 .fini = &sumo_dpm_fini,
1507 .get_sclk = &sumo_dpm_get_sclk,
1508 .get_mclk = &sumo_dpm_get_mclk,
1509 .print_power_state = &sumo_dpm_print_power_state,
Alex Deucherfb701602013-06-28 10:47:56 -04001510 .debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
Alex Deucher5d5e5592013-07-02 18:50:09 -04001511 .force_performance_level = &sumo_dpm_force_performance_level,
Alex Deucher2f8e1eb2014-09-30 10:58:22 -04001512 .get_current_sclk = &sumo_dpm_get_current_sclk,
1513 .get_current_mclk = &sumo_dpm_get_current_mclk,
Alex Deucher80ea2c12013-04-12 14:56:21 -04001514 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001515 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001516 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001517 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001518 },
Alex Deucher958261d2010-11-22 17:56:30 -05001519};
1520
Alex Deuchera43b7662011-01-06 21:19:33 -05001521static struct radeon_asic btc_asic = {
1522 .init = &evergreen_init,
1523 .fini = &evergreen_fini,
1524 .suspend = &evergreen_suspend,
1525 .resume = &evergreen_resume,
Alex Deuchera43b7662011-01-06 21:19:33 -05001526 .asic_reset = &evergreen_asic_reset,
1527 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001528 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001529 .gui_idle = &r600_gui_idle,
1530 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001531 .get_xclk = &rv770_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001532 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deucherff609972014-10-01 09:43:38 -04001533 .get_allowed_info_register = evergreen_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001534 .gart = {
1535 .tlb_flush = &evergreen_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001536 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001537 .set_page = &rs600_gart_set_page,
1538 },
Christian König4c87bc22011-10-19 19:02:21 +02001539 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001540 [RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
1541 [R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
1542 [R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001543 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001544 .irq = {
1545 .set = &evergreen_irq_set,
1546 .process = &evergreen_irq_process,
1547 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001548 .display = {
1549 .bandwidth_update = &evergreen_bandwidth_update,
1550 .get_vblank_counter = &evergreen_get_vblank_counter,
1551 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001552 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001553 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001554 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001555 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001556 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001557 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher233d1ad2012-12-04 15:25:59 -05001558 .dma = &evergreen_copy_dma,
1559 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001560 .copy = &evergreen_copy_dma,
1561 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001562 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001563 .surface = {
1564 .set_reg = r600_set_surface_reg,
1565 .clear_reg = r600_clear_surface_reg,
1566 },
Alex Deucher901ea572012-02-23 17:53:39 -05001567 .hpd = {
1568 .init = &evergreen_hpd_init,
1569 .fini = &evergreen_hpd_fini,
1570 .sense = &evergreen_hpd_sense,
1571 .set_polarity = &evergreen_hpd_set_polarity,
1572 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001573 .pm = {
1574 .misc = &evergreen_pm_misc,
1575 .prepare = &evergreen_pm_prepare,
1576 .finish = &evergreen_pm_finish,
Alex Deucher27810fb2012-10-01 19:25:11 -04001577 .init_profile = &btc_pm_init_profile,
Alex Deuchera02fa392012-02-23 17:53:41 -05001578 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001579 .get_engine_clock = &radeon_atom_get_engine_clock,
1580 .set_engine_clock = &radeon_atom_set_engine_clock,
1581 .get_memory_clock = &radeon_atom_get_memory_clock,
1582 .set_memory_clock = &radeon_atom_set_memory_clock,
Alex Deucher55b615a2013-03-18 18:57:27 -04001583 .get_pcie_lanes = &r600_get_pcie_lanes,
1584 .set_pcie_lanes = &r600_set_pcie_lanes,
Alex Deucher798bcf72012-02-23 17:53:48 -05001585 .set_clock_gating = NULL,
Alex Deuchera8b49252013-04-08 12:41:33 +02001586 .set_uvd_clocks = &evergreen_set_uvd_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001587 .get_temperature = &evergreen_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -05001588 },
Alex Deucher6596afd2013-06-26 00:15:24 -04001589 .dpm = {
1590 .init = &btc_dpm_init,
1591 .setup_asic = &btc_dpm_setup_asic,
1592 .enable = &btc_dpm_enable,
Alex Deuchera3f11242013-12-19 13:48:36 -05001593 .late_enable = &rv770_dpm_late_enable,
Alex Deucher6596afd2013-06-26 00:15:24 -04001594 .disable = &btc_dpm_disable,
Alex Deuchere8a95392013-01-16 14:17:23 -05001595 .pre_set_power_state = &btc_dpm_pre_set_power_state,
Alex Deucher6596afd2013-06-26 00:15:24 -04001596 .set_power_state = &btc_dpm_set_power_state,
Alex Deuchere8a95392013-01-16 14:17:23 -05001597 .post_set_power_state = &btc_dpm_post_set_power_state,
Alex Deucher6596afd2013-06-26 00:15:24 -04001598 .display_configuration_changed = &cypress_dpm_display_configuration_changed,
1599 .fini = &btc_dpm_fini,
Alex Deuchere8a95392013-01-16 14:17:23 -05001600 .get_sclk = &btc_dpm_get_sclk,
1601 .get_mclk = &btc_dpm_get_mclk,
Alex Deucher6596afd2013-06-26 00:15:24 -04001602 .print_power_state = &rv770_dpm_print_power_state,
Alex Deucher9f3f63f2014-01-30 11:19:22 -05001603 .debugfs_print_current_performance_level = &btc_dpm_debugfs_print_current_performance_level,
Alex Deucher8b5e6b72013-07-02 18:40:35 -04001604 .force_performance_level = &rv770_dpm_force_performance_level,
Alex Deuchera84301c2013-07-08 12:03:55 -04001605 .vblank_too_short = &btc_dpm_vblank_too_short,
Alex Deucher99550ee2014-09-30 10:39:30 -04001606 .get_current_sclk = &btc_dpm_get_current_sclk,
1607 .get_current_mclk = &btc_dpm_get_current_mclk,
Alex Deucher6596afd2013-06-26 00:15:24 -04001608 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001609 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001610 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001611 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001612 },
Alex Deuchera43b7662011-01-06 21:19:33 -05001613};
1614
Julia Lawalld26678d2015-11-29 17:12:41 +01001615static const struct radeon_asic_ring cayman_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001616 .ib_execute = &cayman_ring_ib_execute,
1617 .ib_parse = &evergreen_ib_parse,
1618 .emit_fence = &cayman_fence_ring_emit,
1619 .emit_semaphore = &r600_semaphore_ring_emit,
1620 .cs_parse = &evergreen_cs_parse,
1621 .ring_test = &r600_ring_test,
1622 .ib_test = &r600_ib_test,
1623 .is_lockup = &cayman_gfx_is_lockup,
1624 .vm_flush = &cayman_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05001625 .get_rptr = &cayman_gfx_get_rptr,
1626 .get_wptr = &cayman_gfx_get_wptr,
1627 .set_wptr = &cayman_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001628};
1629
Julia Lawalld26678d2015-11-29 17:12:41 +01001630static const struct radeon_asic_ring cayman_dma_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001631 .ib_execute = &cayman_dma_ring_ib_execute,
1632 .ib_parse = &evergreen_dma_ib_parse,
1633 .emit_fence = &evergreen_dma_fence_ring_emit,
1634 .emit_semaphore = &r600_dma_semaphore_ring_emit,
1635 .cs_parse = &evergreen_dma_cs_parse,
1636 .ring_test = &r600_dma_ring_test,
1637 .ib_test = &r600_dma_ib_test,
1638 .is_lockup = &cayman_dma_is_lockup,
1639 .vm_flush = &cayman_dma_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05001640 .get_rptr = &cayman_dma_get_rptr,
1641 .get_wptr = &cayman_dma_get_wptr,
1642 .set_wptr = &cayman_dma_set_wptr
Christian König76a0df82013-08-13 11:56:50 +02001643};
1644
Julia Lawalld26678d2015-11-29 17:12:41 +01001645static const struct radeon_asic_ring cayman_uvd_ring = {
Christian Könige409b122013-08-13 11:56:53 +02001646 .ib_execute = &uvd_v1_0_ib_execute,
1647 .emit_fence = &uvd_v2_2_fence_emit,
1648 .emit_semaphore = &uvd_v3_1_semaphore_emit,
Christian König76a0df82013-08-13 11:56:50 +02001649 .cs_parse = &radeon_uvd_cs_parse,
Christian Könige409b122013-08-13 11:56:53 +02001650 .ring_test = &uvd_v1_0_ring_test,
1651 .ib_test = &uvd_v1_0_ib_test,
Christian König76a0df82013-08-13 11:56:50 +02001652 .is_lockup = &radeon_ring_test_lockup,
Christian Könige409b122013-08-13 11:56:53 +02001653 .get_rptr = &uvd_v1_0_get_rptr,
1654 .get_wptr = &uvd_v1_0_get_wptr,
1655 .set_wptr = &uvd_v1_0_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001656};
1657
Alex Deuchere3487622011-03-02 20:07:36 -05001658static struct radeon_asic cayman_asic = {
1659 .init = &cayman_init,
1660 .fini = &cayman_fini,
1661 .suspend = &cayman_suspend,
1662 .resume = &cayman_resume,
Alex Deuchere3487622011-03-02 20:07:36 -05001663 .asic_reset = &cayman_asic_reset,
1664 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001665 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher54e88e02012-02-23 18:10:29 -05001666 .gui_idle = &r600_gui_idle,
1667 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001668 .get_xclk = &rv770_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001669 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deuchere66582f2014-10-01 09:51:29 -04001670 .get_allowed_info_register = cayman_get_allowed_info_register,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001671 .gart = {
1672 .tlb_flush = &cayman_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001673 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherc5b3b852012-02-23 17:53:46 -05001674 .set_page = &rs600_gart_set_page,
1675 },
Christian König05b07142012-08-06 20:21:10 +02001676 .vm = {
1677 .init = &cayman_vm_init,
1678 .fini = &cayman_vm_fini,
Christian König03f62ab2014-07-30 21:05:17 +02001679 .copy_pages = &cayman_dma_vm_copy_pages,
1680 .write_pages = &cayman_dma_vm_write_pages,
1681 .set_pages = &cayman_dma_vm_set_pages,
1682 .pad_ib = &cayman_dma_vm_pad_ib,
Christian König05b07142012-08-06 20:21:10 +02001683 },
Christian König4c87bc22011-10-19 19:02:21 +02001684 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001685 [RADEON_RING_TYPE_GFX_INDEX] = &cayman_gfx_ring,
1686 [CAYMAN_RING_TYPE_CP1_INDEX] = &cayman_gfx_ring,
1687 [CAYMAN_RING_TYPE_CP2_INDEX] = &cayman_gfx_ring,
1688 [R600_RING_TYPE_DMA_INDEX] = &cayman_dma_ring,
1689 [CAYMAN_RING_TYPE_DMA1_INDEX] = &cayman_dma_ring,
1690 [R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
Christian König4c87bc22011-10-19 19:02:21 +02001691 },
Alex Deucherb35ea4a2012-02-23 17:53:43 -05001692 .irq = {
1693 .set = &evergreen_irq_set,
1694 .process = &evergreen_irq_process,
1695 },
Alex Deucherc79a49c2012-02-23 17:53:47 -05001696 .display = {
1697 .bandwidth_update = &evergreen_bandwidth_update,
1698 .get_vblank_counter = &evergreen_get_vblank_counter,
1699 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001700 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001701 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherc79a49c2012-02-23 17:53:47 -05001702 },
Alex Deucher27cd7762012-02-23 17:53:42 -05001703 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001704 .blit = &r600_copy_cpdma,
Alex Deucher27cd7762012-02-23 17:53:42 -05001705 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucherf60cbd12012-12-04 15:27:33 -05001706 .dma = &evergreen_copy_dma,
1707 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001708 .copy = &evergreen_copy_dma,
1709 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher27cd7762012-02-23 17:53:42 -05001710 },
Alex Deucher9e6f3d02012-02-23 17:53:49 -05001711 .surface = {
1712 .set_reg = r600_set_surface_reg,
1713 .clear_reg = r600_clear_surface_reg,
1714 },
Alex Deucher901ea572012-02-23 17:53:39 -05001715 .hpd = {
1716 .init = &evergreen_hpd_init,
1717 .fini = &evergreen_hpd_fini,
1718 .sense = &evergreen_hpd_sense,
1719 .set_polarity = &evergreen_hpd_set_polarity,
1720 },
Alex Deuchera02fa392012-02-23 17:53:41 -05001721 .pm = {
1722 .misc = &evergreen_pm_misc,
1723 .prepare = &evergreen_pm_prepare,
1724 .finish = &evergreen_pm_finish,
Alex Deucher27810fb2012-10-01 19:25:11 -04001725 .init_profile = &btc_pm_init_profile,
Alex Deuchera02fa392012-02-23 17:53:41 -05001726 .get_dynpm_state = &r600_pm_get_dynpm_state,
Alex Deucher798bcf72012-02-23 17:53:48 -05001727 .get_engine_clock = &radeon_atom_get_engine_clock,
1728 .set_engine_clock = &radeon_atom_set_engine_clock,
1729 .get_memory_clock = &radeon_atom_get_memory_clock,
1730 .set_memory_clock = &radeon_atom_set_memory_clock,
Alex Deucher55b615a2013-03-18 18:57:27 -04001731 .get_pcie_lanes = &r600_get_pcie_lanes,
1732 .set_pcie_lanes = &r600_set_pcie_lanes,
Alex Deucher798bcf72012-02-23 17:53:48 -05001733 .set_clock_gating = NULL,
Alex Deuchera8b49252013-04-08 12:41:33 +02001734 .set_uvd_clocks = &evergreen_set_uvd_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001735 .get_temperature = &evergreen_get_temp,
Alex Deuchera02fa392012-02-23 17:53:41 -05001736 },
Alex Deucher69e0b572013-04-12 16:42:42 -04001737 .dpm = {
1738 .init = &ni_dpm_init,
1739 .setup_asic = &ni_dpm_setup_asic,
1740 .enable = &ni_dpm_enable,
Alex Deuchera3f11242013-12-19 13:48:36 -05001741 .late_enable = &rv770_dpm_late_enable,
Alex Deucher69e0b572013-04-12 16:42:42 -04001742 .disable = &ni_dpm_disable,
Alex Deucherfee3d742013-01-16 14:35:39 -05001743 .pre_set_power_state = &ni_dpm_pre_set_power_state,
Alex Deucher69e0b572013-04-12 16:42:42 -04001744 .set_power_state = &ni_dpm_set_power_state,
Alex Deucherfee3d742013-01-16 14:35:39 -05001745 .post_set_power_state = &ni_dpm_post_set_power_state,
Alex Deucher69e0b572013-04-12 16:42:42 -04001746 .display_configuration_changed = &cypress_dpm_display_configuration_changed,
1747 .fini = &ni_dpm_fini,
1748 .get_sclk = &ni_dpm_get_sclk,
1749 .get_mclk = &ni_dpm_get_mclk,
1750 .print_power_state = &ni_dpm_print_power_state,
Alex Deucherbdf0c4f2013-06-28 17:49:02 -04001751 .debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level,
Alex Deucher170a47f2013-07-02 18:43:53 -04001752 .force_performance_level = &ni_dpm_force_performance_level,
Alex Deucher76ad73e2013-07-08 12:09:41 -04001753 .vblank_too_short = &ni_dpm_vblank_too_short,
Alex Deucher1d633e32014-09-30 10:46:02 -04001754 .get_current_sclk = &ni_dpm_get_current_sclk,
1755 .get_current_mclk = &ni_dpm_get_current_mclk,
Alex Deucher69e0b572013-04-12 16:42:42 -04001756 },
Alex Deucher0f9e0062012-02-23 17:53:40 -05001757 .pflip = {
Alex Deucher0f9e0062012-02-23 17:53:40 -05001758 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001759 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0f9e0062012-02-23 17:53:40 -05001760 },
Alex Deuchere3487622011-03-02 20:07:36 -05001761};
1762
Julia Lawalld26678d2015-11-29 17:12:41 +01001763static const struct radeon_asic_ring trinity_vce_ring = {
Christian Königa918efa2015-05-11 22:01:53 +02001764 .ib_execute = &radeon_vce_ib_execute,
1765 .emit_fence = &radeon_vce_fence_emit,
1766 .emit_semaphore = &radeon_vce_semaphore_emit,
1767 .cs_parse = &radeon_vce_cs_parse,
1768 .ring_test = &radeon_vce_ring_test,
1769 .ib_test = &radeon_vce_ib_test,
1770 .is_lockup = &radeon_ring_test_lockup,
1771 .get_rptr = &vce_v1_0_get_rptr,
1772 .get_wptr = &vce_v1_0_get_wptr,
1773 .set_wptr = &vce_v1_0_set_wptr,
1774};
1775
Alex Deucherbe63fe82012-03-20 17:18:40 -04001776static struct radeon_asic trinity_asic = {
1777 .init = &cayman_init,
1778 .fini = &cayman_fini,
1779 .suspend = &cayman_suspend,
1780 .resume = &cayman_resume,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001781 .asic_reset = &cayman_asic_reset,
1782 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001783 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001784 .gui_idle = &r600_gui_idle,
1785 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001786 .get_xclk = &r600_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001787 .get_gpu_clock_counter = &r600_get_gpu_clock_counter,
Alex Deuchere66582f2014-10-01 09:51:29 -04001788 .get_allowed_info_register = cayman_get_allowed_info_register,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001789 .gart = {
1790 .tlb_flush = &cayman_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001791 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001792 .set_page = &rs600_gart_set_page,
1793 },
Christian König05b07142012-08-06 20:21:10 +02001794 .vm = {
1795 .init = &cayman_vm_init,
1796 .fini = &cayman_vm_fini,
Christian König03f62ab2014-07-30 21:05:17 +02001797 .copy_pages = &cayman_dma_vm_copy_pages,
1798 .write_pages = &cayman_dma_vm_write_pages,
1799 .set_pages = &cayman_dma_vm_set_pages,
1800 .pad_ib = &cayman_dma_vm_pad_ib,
Christian König05b07142012-08-06 20:21:10 +02001801 },
Alex Deucherbe63fe82012-03-20 17:18:40 -04001802 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001803 [RADEON_RING_TYPE_GFX_INDEX] = &cayman_gfx_ring,
1804 [CAYMAN_RING_TYPE_CP1_INDEX] = &cayman_gfx_ring,
1805 [CAYMAN_RING_TYPE_CP2_INDEX] = &cayman_gfx_ring,
1806 [R600_RING_TYPE_DMA_INDEX] = &cayman_dma_ring,
1807 [CAYMAN_RING_TYPE_DMA1_INDEX] = &cayman_dma_ring,
1808 [R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
Christian Königa918efa2015-05-11 22:01:53 +02001809 [TN_RING_TYPE_VCE1_INDEX] = &trinity_vce_ring,
1810 [TN_RING_TYPE_VCE2_INDEX] = &trinity_vce_ring,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001811 },
1812 .irq = {
1813 .set = &evergreen_irq_set,
1814 .process = &evergreen_irq_process,
1815 },
1816 .display = {
1817 .bandwidth_update = &dce6_bandwidth_update,
1818 .get_vblank_counter = &evergreen_get_vblank_counter,
1819 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001820 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001821 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001822 },
1823 .copy = {
Alex Deucher8dddb992013-07-12 14:52:30 -04001824 .blit = &r600_copy_cpdma,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001825 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucherf60cbd12012-12-04 15:27:33 -05001826 .dma = &evergreen_copy_dma,
1827 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001828 .copy = &evergreen_copy_dma,
1829 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001830 },
1831 .surface = {
1832 .set_reg = r600_set_surface_reg,
1833 .clear_reg = r600_clear_surface_reg,
1834 },
1835 .hpd = {
1836 .init = &evergreen_hpd_init,
1837 .fini = &evergreen_hpd_fini,
1838 .sense = &evergreen_hpd_sense,
1839 .set_polarity = &evergreen_hpd_set_polarity,
1840 },
1841 .pm = {
1842 .misc = &evergreen_pm_misc,
1843 .prepare = &evergreen_pm_prepare,
1844 .finish = &evergreen_pm_finish,
1845 .init_profile = &sumo_pm_init_profile,
1846 .get_dynpm_state = &r600_pm_get_dynpm_state,
1847 .get_engine_clock = &radeon_atom_get_engine_clock,
1848 .set_engine_clock = &radeon_atom_set_engine_clock,
1849 .get_memory_clock = NULL,
1850 .set_memory_clock = NULL,
1851 .get_pcie_lanes = NULL,
1852 .set_pcie_lanes = NULL,
1853 .set_clock_gating = NULL,
Alex Deucher23d33ba2013-04-08 12:41:32 +02001854 .set_uvd_clocks = &sumo_set_uvd_clocks,
Alex Deucher0fda42a2015-05-11 22:01:50 +02001855 .set_vce_clocks = &tn_set_vce_clocks,
Alex Deucher29a15222012-12-14 11:57:36 -05001856 .get_temperature = &tn_get_temp,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001857 },
Alex Deucherd70229f2013-04-12 16:40:41 -04001858 .dpm = {
1859 .init = &trinity_dpm_init,
1860 .setup_asic = &trinity_dpm_setup_asic,
1861 .enable = &trinity_dpm_enable,
Alex Deucherbda44c12013-12-19 12:03:35 -05001862 .late_enable = &trinity_dpm_late_enable,
Alex Deucherd70229f2013-04-12 16:40:41 -04001863 .disable = &trinity_dpm_disable,
Alex Deuchera284c482013-01-16 13:53:40 -05001864 .pre_set_power_state = &trinity_dpm_pre_set_power_state,
Alex Deucherd70229f2013-04-12 16:40:41 -04001865 .set_power_state = &trinity_dpm_set_power_state,
Alex Deuchera284c482013-01-16 13:53:40 -05001866 .post_set_power_state = &trinity_dpm_post_set_power_state,
Alex Deucherd70229f2013-04-12 16:40:41 -04001867 .display_configuration_changed = &trinity_dpm_display_configuration_changed,
1868 .fini = &trinity_dpm_fini,
1869 .get_sclk = &trinity_dpm_get_sclk,
1870 .get_mclk = &trinity_dpm_get_mclk,
1871 .print_power_state = &trinity_dpm_print_power_state,
Alex Deucher490ab932013-06-28 12:01:38 -04001872 .debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level,
Alex Deucher9b5de592013-07-02 18:52:10 -04001873 .force_performance_level = &trinity_dpm_force_performance_level,
Alex Deucher11877062013-09-09 19:19:52 -04001874 .enable_bapm = &trinity_dpm_enable_bapm,
Alex Deucher7ce9cda2014-09-30 11:01:59 -04001875 .get_current_sclk = &trinity_dpm_get_current_sclk,
1876 .get_current_mclk = &trinity_dpm_get_current_mclk,
Alex Deucherd70229f2013-04-12 16:40:41 -04001877 },
Alex Deucherbe63fe82012-03-20 17:18:40 -04001878 .pflip = {
Alex Deucherbe63fe82012-03-20 17:18:40 -04001879 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02001880 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucherbe63fe82012-03-20 17:18:40 -04001881 },
1882};
1883
Julia Lawalld26678d2015-11-29 17:12:41 +01001884static const struct radeon_asic_ring si_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001885 .ib_execute = &si_ring_ib_execute,
1886 .ib_parse = &si_ib_parse,
1887 .emit_fence = &si_fence_ring_emit,
1888 .emit_semaphore = &r600_semaphore_ring_emit,
1889 .cs_parse = NULL,
1890 .ring_test = &r600_ring_test,
1891 .ib_test = &r600_ib_test,
1892 .is_lockup = &si_gfx_is_lockup,
1893 .vm_flush = &si_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05001894 .get_rptr = &cayman_gfx_get_rptr,
1895 .get_wptr = &cayman_gfx_get_wptr,
1896 .set_wptr = &cayman_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001897};
1898
Julia Lawalld26678d2015-11-29 17:12:41 +01001899static const struct radeon_asic_ring si_dma_ring = {
Christian König76a0df82013-08-13 11:56:50 +02001900 .ib_execute = &cayman_dma_ring_ib_execute,
1901 .ib_parse = &evergreen_dma_ib_parse,
1902 .emit_fence = &evergreen_dma_fence_ring_emit,
1903 .emit_semaphore = &r600_dma_semaphore_ring_emit,
1904 .cs_parse = NULL,
1905 .ring_test = &r600_dma_ring_test,
1906 .ib_test = &r600_dma_ib_test,
1907 .is_lockup = &si_dma_is_lockup,
1908 .vm_flush = &si_dma_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05001909 .get_rptr = &cayman_dma_get_rptr,
1910 .get_wptr = &cayman_dma_get_wptr,
1911 .set_wptr = &cayman_dma_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02001912};
1913
Alex Deucher02779c02012-03-20 17:18:25 -04001914static struct radeon_asic si_asic = {
1915 .init = &si_init,
1916 .fini = &si_fini,
1917 .suspend = &si_suspend,
1918 .resume = &si_resume,
Alex Deucher02779c02012-03-20 17:18:25 -04001919 .asic_reset = &si_asic_reset,
1920 .vga_set_state = &r600_vga_set_state,
Michel Dänzer124764f2014-07-31 18:43:48 +09001921 .mmio_hdp_flush = r600_mmio_hdp_flush,
Alex Deucher02779c02012-03-20 17:18:25 -04001922 .gui_idle = &r600_gui_idle,
1923 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
Alex Deucher454d2e22013-02-14 10:04:02 -05001924 .get_xclk = &si_get_xclk,
Alex Deucherd0418892013-01-24 10:35:23 -05001925 .get_gpu_clock_counter = &si_get_gpu_clock_counter,
Alex Deucher4af692f2014-10-01 10:03:31 -04001926 .get_allowed_info_register = si_get_allowed_info_register,
Alex Deucher02779c02012-03-20 17:18:25 -04001927 .gart = {
1928 .tlb_flush = &si_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09001929 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucher02779c02012-03-20 17:18:25 -04001930 .set_page = &rs600_gart_set_page,
1931 },
Christian König05b07142012-08-06 20:21:10 +02001932 .vm = {
1933 .init = &si_vm_init,
1934 .fini = &si_vm_fini,
Christian König03f62ab2014-07-30 21:05:17 +02001935 .copy_pages = &si_dma_vm_copy_pages,
1936 .write_pages = &si_dma_vm_write_pages,
1937 .set_pages = &si_dma_vm_set_pages,
1938 .pad_ib = &cayman_dma_vm_pad_ib,
Christian König05b07142012-08-06 20:21:10 +02001939 },
Alex Deucher02779c02012-03-20 17:18:25 -04001940 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02001941 [RADEON_RING_TYPE_GFX_INDEX] = &si_gfx_ring,
1942 [CAYMAN_RING_TYPE_CP1_INDEX] = &si_gfx_ring,
1943 [CAYMAN_RING_TYPE_CP2_INDEX] = &si_gfx_ring,
1944 [R600_RING_TYPE_DMA_INDEX] = &si_dma_ring,
1945 [CAYMAN_RING_TYPE_DMA1_INDEX] = &si_dma_ring,
1946 [R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
Christian Königa918efa2015-05-11 22:01:53 +02001947 [TN_RING_TYPE_VCE1_INDEX] = &trinity_vce_ring,
1948 [TN_RING_TYPE_VCE2_INDEX] = &trinity_vce_ring,
Alex Deucher02779c02012-03-20 17:18:25 -04001949 },
1950 .irq = {
1951 .set = &si_irq_set,
1952 .process = &si_irq_process,
1953 },
1954 .display = {
1955 .bandwidth_update = &dce6_bandwidth_update,
1956 .get_vblank_counter = &evergreen_get_vblank_counter,
1957 .wait_for_vblank = &dce4_wait_for_vblank,
Alex Deucher37e9b6a2012-08-03 11:39:43 -04001958 .set_backlight_level = &atombios_set_backlight_level,
Alex Deucher6d92f812012-09-14 09:59:26 -04001959 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucher02779c02012-03-20 17:18:25 -04001960 },
1961 .copy = {
Alex Deucher5c722732013-10-01 16:17:14 -04001962 .blit = &r600_copy_cpdma,
Alex Deucher02779c02012-03-20 17:18:25 -04001963 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
Alex Deucher8c5fd7e2012-12-04 15:28:18 -05001964 .dma = &si_copy_dma,
1965 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher2d6cc722012-07-20 13:49:49 -04001966 .copy = &si_copy_dma,
1967 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher02779c02012-03-20 17:18:25 -04001968 },
1969 .surface = {
1970 .set_reg = r600_set_surface_reg,
1971 .clear_reg = r600_clear_surface_reg,
1972 },
1973 .hpd = {
1974 .init = &evergreen_hpd_init,
1975 .fini = &evergreen_hpd_fini,
1976 .sense = &evergreen_hpd_sense,
1977 .set_polarity = &evergreen_hpd_set_polarity,
1978 },
1979 .pm = {
1980 .misc = &evergreen_pm_misc,
1981 .prepare = &evergreen_pm_prepare,
1982 .finish = &evergreen_pm_finish,
1983 .init_profile = &sumo_pm_init_profile,
1984 .get_dynpm_state = &r600_pm_get_dynpm_state,
1985 .get_engine_clock = &radeon_atom_get_engine_clock,
1986 .set_engine_clock = &radeon_atom_set_engine_clock,
1987 .get_memory_clock = &radeon_atom_get_memory_clock,
1988 .set_memory_clock = &radeon_atom_set_memory_clock,
Alex Deucher55b615a2013-03-18 18:57:27 -04001989 .get_pcie_lanes = &r600_get_pcie_lanes,
1990 .set_pcie_lanes = &r600_set_pcie_lanes,
Alex Deucher02779c02012-03-20 17:18:25 -04001991 .set_clock_gating = NULL,
Christian König2539eb02013-04-08 12:41:34 +02001992 .set_uvd_clocks = &si_set_uvd_clocks,
Christian Königb7af6302015-05-11 22:01:49 +02001993 .set_vce_clocks = &si_set_vce_clocks,
Alex Deucher6bd1c382013-06-21 14:38:03 -04001994 .get_temperature = &si_get_temp,
Alex Deucher02779c02012-03-20 17:18:25 -04001995 },
Alex Deuchera9e61412013-06-25 17:56:16 -04001996 .dpm = {
1997 .init = &si_dpm_init,
1998 .setup_asic = &si_dpm_setup_asic,
1999 .enable = &si_dpm_enable,
Alex Deucher963c1152013-12-19 13:54:35 -05002000 .late_enable = &si_dpm_late_enable,
Alex Deuchera9e61412013-06-25 17:56:16 -04002001 .disable = &si_dpm_disable,
2002 .pre_set_power_state = &si_dpm_pre_set_power_state,
2003 .set_power_state = &si_dpm_set_power_state,
2004 .post_set_power_state = &si_dpm_post_set_power_state,
2005 .display_configuration_changed = &si_dpm_display_configuration_changed,
2006 .fini = &si_dpm_fini,
2007 .get_sclk = &ni_dpm_get_sclk,
2008 .get_mclk = &ni_dpm_get_mclk,
2009 .print_power_state = &ni_dpm_print_power_state,
Alex Deucher79821282013-06-28 18:02:19 -04002010 .debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
Alex Deuchera160a6a2013-07-02 18:46:28 -04002011 .force_performance_level = &si_dpm_force_performance_level,
Alex Deucherf4dec312013-07-08 12:15:11 -04002012 .vblank_too_short = &ni_dpm_vblank_too_short,
Alex Deucher5e8150a2015-01-07 15:29:06 -05002013 .fan_ctrl_set_mode = &si_fan_ctrl_set_mode,
2014 .fan_ctrl_get_mode = &si_fan_ctrl_get_mode,
2015 .get_fan_speed_percent = &si_fan_ctrl_get_fan_speed_percent,
2016 .set_fan_speed_percent = &si_fan_ctrl_set_fan_speed_percent,
Alex Deucherca1110b2014-09-30 10:50:07 -04002017 .get_current_sclk = &si_dpm_get_current_sclk,
2018 .get_current_mclk = &si_dpm_get_current_mclk,
Alex Deuchera9e61412013-06-25 17:56:16 -04002019 },
Alex Deucher02779c02012-03-20 17:18:25 -04002020 .pflip = {
Alex Deucher02779c02012-03-20 17:18:25 -04002021 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02002022 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher02779c02012-03-20 17:18:25 -04002023 },
2024};
2025
Julia Lawalld26678d2015-11-29 17:12:41 +01002026static const struct radeon_asic_ring ci_gfx_ring = {
Christian König76a0df82013-08-13 11:56:50 +02002027 .ib_execute = &cik_ring_ib_execute,
2028 .ib_parse = &cik_ib_parse,
2029 .emit_fence = &cik_fence_gfx_ring_emit,
2030 .emit_semaphore = &cik_semaphore_ring_emit,
2031 .cs_parse = NULL,
2032 .ring_test = &cik_ring_test,
2033 .ib_test = &cik_ib_test,
2034 .is_lockup = &cik_gfx_is_lockup,
2035 .vm_flush = &cik_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05002036 .get_rptr = &cik_gfx_get_rptr,
2037 .get_wptr = &cik_gfx_get_wptr,
2038 .set_wptr = &cik_gfx_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02002039};
2040
Julia Lawalld26678d2015-11-29 17:12:41 +01002041static const struct radeon_asic_ring ci_cp_ring = {
Christian König76a0df82013-08-13 11:56:50 +02002042 .ib_execute = &cik_ring_ib_execute,
2043 .ib_parse = &cik_ib_parse,
2044 .emit_fence = &cik_fence_compute_ring_emit,
2045 .emit_semaphore = &cik_semaphore_ring_emit,
2046 .cs_parse = NULL,
2047 .ring_test = &cik_ring_test,
2048 .ib_test = &cik_ib_test,
2049 .is_lockup = &cik_gfx_is_lockup,
2050 .vm_flush = &cik_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05002051 .get_rptr = &cik_compute_get_rptr,
2052 .get_wptr = &cik_compute_get_wptr,
2053 .set_wptr = &cik_compute_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02002054};
2055
Julia Lawalld26678d2015-11-29 17:12:41 +01002056static const struct radeon_asic_ring ci_dma_ring = {
Christian König76a0df82013-08-13 11:56:50 +02002057 .ib_execute = &cik_sdma_ring_ib_execute,
2058 .ib_parse = &cik_ib_parse,
2059 .emit_fence = &cik_sdma_fence_ring_emit,
2060 .emit_semaphore = &cik_sdma_semaphore_ring_emit,
2061 .cs_parse = NULL,
2062 .ring_test = &cik_sdma_ring_test,
2063 .ib_test = &cik_sdma_ib_test,
2064 .is_lockup = &cik_sdma_is_lockup,
2065 .vm_flush = &cik_dma_vm_flush,
Alex Deucherea31bf62013-12-09 19:44:30 -05002066 .get_rptr = &cik_sdma_get_rptr,
2067 .get_wptr = &cik_sdma_get_wptr,
2068 .set_wptr = &cik_sdma_set_wptr,
Christian König76a0df82013-08-13 11:56:50 +02002069};
2070
Julia Lawalld26678d2015-11-29 17:12:41 +01002071static const struct radeon_asic_ring ci_vce_ring = {
Christian Königd93f7932013-05-23 12:10:04 +02002072 .ib_execute = &radeon_vce_ib_execute,
2073 .emit_fence = &radeon_vce_fence_emit,
2074 .emit_semaphore = &radeon_vce_semaphore_emit,
2075 .cs_parse = &radeon_vce_cs_parse,
2076 .ring_test = &radeon_vce_ring_test,
2077 .ib_test = &radeon_vce_ib_test,
2078 .is_lockup = &radeon_ring_test_lockup,
2079 .get_rptr = &vce_v1_0_get_rptr,
2080 .get_wptr = &vce_v1_0_get_wptr,
2081 .set_wptr = &vce_v1_0_set_wptr,
2082};
2083
Alex Deucher0672e272013-04-09 16:22:31 -04002084static struct radeon_asic ci_asic = {
2085 .init = &cik_init,
2086 .fini = &cik_fini,
2087 .suspend = &cik_suspend,
2088 .resume = &cik_resume,
2089 .asic_reset = &cik_asic_reset,
2090 .vga_set_state = &r600_vga_set_state,
Michel Dänzer72a99872014-07-31 18:43:49 +09002091 .mmio_hdp_flush = &r600_mmio_hdp_flush,
Alex Deucher0672e272013-04-09 16:22:31 -04002092 .gui_idle = &r600_gui_idle,
2093 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
2094 .get_xclk = &cik_get_xclk,
2095 .get_gpu_clock_counter = &cik_get_gpu_clock_counter,
Alex Deucher353eec22014-10-01 11:18:46 -04002096 .get_allowed_info_register = cik_get_allowed_info_register,
Alex Deucher0672e272013-04-09 16:22:31 -04002097 .gart = {
2098 .tlb_flush = &cik_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09002099 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucher0672e272013-04-09 16:22:31 -04002100 .set_page = &rs600_gart_set_page,
2101 },
2102 .vm = {
2103 .init = &cik_vm_init,
2104 .fini = &cik_vm_fini,
Christian König03f62ab2014-07-30 21:05:17 +02002105 .copy_pages = &cik_sdma_vm_copy_pages,
2106 .write_pages = &cik_sdma_vm_write_pages,
2107 .set_pages = &cik_sdma_vm_set_pages,
2108 .pad_ib = &cik_sdma_vm_pad_ib,
Alex Deucher0672e272013-04-09 16:22:31 -04002109 },
2110 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02002111 [RADEON_RING_TYPE_GFX_INDEX] = &ci_gfx_ring,
2112 [CAYMAN_RING_TYPE_CP1_INDEX] = &ci_cp_ring,
2113 [CAYMAN_RING_TYPE_CP2_INDEX] = &ci_cp_ring,
2114 [R600_RING_TYPE_DMA_INDEX] = &ci_dma_ring,
2115 [CAYMAN_RING_TYPE_DMA1_INDEX] = &ci_dma_ring,
2116 [R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
Christian Königd93f7932013-05-23 12:10:04 +02002117 [TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
2118 [TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
Alex Deucher0672e272013-04-09 16:22:31 -04002119 },
2120 .irq = {
2121 .set = &cik_irq_set,
2122 .process = &cik_irq_process,
2123 },
2124 .display = {
2125 .bandwidth_update = &dce8_bandwidth_update,
2126 .get_vblank_counter = &evergreen_get_vblank_counter,
2127 .wait_for_vblank = &dce4_wait_for_vblank,
Samuel Li7272c9d2013-11-19 15:04:45 -05002128 .set_backlight_level = &atombios_set_backlight_level,
2129 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucher0672e272013-04-09 16:22:31 -04002130 },
2131 .copy = {
Alex Deucher78196782013-12-09 17:38:51 -05002132 .blit = &cik_copy_cpdma,
Alex Deucher0672e272013-04-09 16:22:31 -04002133 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
2134 .dma = &cik_copy_dma,
2135 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
Christian Königb5be1a82014-06-04 15:29:58 +02002136 .copy = &cik_copy_dma,
2137 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
Alex Deucher0672e272013-04-09 16:22:31 -04002138 },
2139 .surface = {
2140 .set_reg = r600_set_surface_reg,
2141 .clear_reg = r600_clear_surface_reg,
2142 },
2143 .hpd = {
2144 .init = &evergreen_hpd_init,
2145 .fini = &evergreen_hpd_fini,
2146 .sense = &evergreen_hpd_sense,
2147 .set_polarity = &evergreen_hpd_set_polarity,
2148 },
2149 .pm = {
2150 .misc = &evergreen_pm_misc,
2151 .prepare = &evergreen_pm_prepare,
2152 .finish = &evergreen_pm_finish,
2153 .init_profile = &sumo_pm_init_profile,
2154 .get_dynpm_state = &r600_pm_get_dynpm_state,
2155 .get_engine_clock = &radeon_atom_get_engine_clock,
2156 .set_engine_clock = &radeon_atom_set_engine_clock,
2157 .get_memory_clock = &radeon_atom_get_memory_clock,
2158 .set_memory_clock = &radeon_atom_set_memory_clock,
2159 .get_pcie_lanes = NULL,
2160 .set_pcie_lanes = NULL,
2161 .set_clock_gating = NULL,
2162 .set_uvd_clocks = &cik_set_uvd_clocks,
Alex Deucher5ad6bf92013-08-22 17:09:06 -04002163 .set_vce_clocks = &cik_set_vce_clocks,
Alex Deucher286d9cc2013-06-21 15:50:47 -04002164 .get_temperature = &ci_get_temp,
Alex Deucher0672e272013-04-09 16:22:31 -04002165 },
Alex Deuchercc8dbbb2013-08-14 01:03:41 -04002166 .dpm = {
2167 .init = &ci_dpm_init,
2168 .setup_asic = &ci_dpm_setup_asic,
2169 .enable = &ci_dpm_enable,
Alex Deucher90208422013-12-19 13:59:46 -05002170 .late_enable = &ci_dpm_late_enable,
Alex Deuchercc8dbbb2013-08-14 01:03:41 -04002171 .disable = &ci_dpm_disable,
2172 .pre_set_power_state = &ci_dpm_pre_set_power_state,
2173 .set_power_state = &ci_dpm_set_power_state,
2174 .post_set_power_state = &ci_dpm_post_set_power_state,
2175 .display_configuration_changed = &ci_dpm_display_configuration_changed,
2176 .fini = &ci_dpm_fini,
2177 .get_sclk = &ci_dpm_get_sclk,
2178 .get_mclk = &ci_dpm_get_mclk,
2179 .print_power_state = &ci_dpm_print_power_state,
Alex Deucher94b4adc2013-07-15 17:34:33 -04002180 .debugfs_print_current_performance_level = &ci_dpm_debugfs_print_current_performance_level,
Alex Deucher89536fd2013-07-15 18:14:24 -04002181 .force_performance_level = &ci_dpm_force_performance_level,
Alex Deucher54961312013-07-15 18:24:31 -04002182 .vblank_too_short = &ci_dpm_vblank_too_short,
Alex Deucher942bdf72013-08-09 10:05:24 -04002183 .powergate_uvd = &ci_dpm_powergate_uvd,
Oleg Chernovskiy36689e52014-12-08 00:10:46 +03002184 .fan_ctrl_set_mode = &ci_fan_ctrl_set_mode,
2185 .fan_ctrl_get_mode = &ci_fan_ctrl_get_mode,
2186 .get_fan_speed_percent = &ci_fan_ctrl_get_fan_speed_percent,
2187 .set_fan_speed_percent = &ci_fan_ctrl_set_fan_speed_percent,
Alex Deucherdbbd3c82014-09-30 10:54:05 -04002188 .get_current_sclk = &ci_dpm_get_current_sclk,
2189 .get_current_mclk = &ci_dpm_get_current_mclk,
Alex Deuchercc8dbbb2013-08-14 01:03:41 -04002190 },
Alex Deucher0672e272013-04-09 16:22:31 -04002191 .pflip = {
Alex Deucher0672e272013-04-09 16:22:31 -04002192 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02002193 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0672e272013-04-09 16:22:31 -04002194 },
2195};
2196
2197static struct radeon_asic kv_asic = {
2198 .init = &cik_init,
2199 .fini = &cik_fini,
2200 .suspend = &cik_suspend,
2201 .resume = &cik_resume,
2202 .asic_reset = &cik_asic_reset,
2203 .vga_set_state = &r600_vga_set_state,
Michel Dänzer72a99872014-07-31 18:43:49 +09002204 .mmio_hdp_flush = &r600_mmio_hdp_flush,
Alex Deucher0672e272013-04-09 16:22:31 -04002205 .gui_idle = &r600_gui_idle,
2206 .mc_wait_for_idle = &evergreen_mc_wait_for_idle,
2207 .get_xclk = &cik_get_xclk,
2208 .get_gpu_clock_counter = &cik_get_gpu_clock_counter,
Alex Deucher353eec22014-10-01 11:18:46 -04002209 .get_allowed_info_register = cik_get_allowed_info_register,
Alex Deucher0672e272013-04-09 16:22:31 -04002210 .gart = {
2211 .tlb_flush = &cik_pcie_gart_tlb_flush,
Michel Dänzercb658902015-01-21 17:36:35 +09002212 .get_page_entry = &rs600_gart_get_page_entry,
Alex Deucher0672e272013-04-09 16:22:31 -04002213 .set_page = &rs600_gart_set_page,
2214 },
2215 .vm = {
2216 .init = &cik_vm_init,
2217 .fini = &cik_vm_fini,
Christian König03f62ab2014-07-30 21:05:17 +02002218 .copy_pages = &cik_sdma_vm_copy_pages,
2219 .write_pages = &cik_sdma_vm_write_pages,
2220 .set_pages = &cik_sdma_vm_set_pages,
2221 .pad_ib = &cik_sdma_vm_pad_ib,
Alex Deucher0672e272013-04-09 16:22:31 -04002222 },
2223 .ring = {
Christian König76a0df82013-08-13 11:56:50 +02002224 [RADEON_RING_TYPE_GFX_INDEX] = &ci_gfx_ring,
2225 [CAYMAN_RING_TYPE_CP1_INDEX] = &ci_cp_ring,
2226 [CAYMAN_RING_TYPE_CP2_INDEX] = &ci_cp_ring,
2227 [R600_RING_TYPE_DMA_INDEX] = &ci_dma_ring,
2228 [CAYMAN_RING_TYPE_DMA1_INDEX] = &ci_dma_ring,
2229 [R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
Christian Königd93f7932013-05-23 12:10:04 +02002230 [TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
2231 [TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
Alex Deucher0672e272013-04-09 16:22:31 -04002232 },
2233 .irq = {
2234 .set = &cik_irq_set,
2235 .process = &cik_irq_process,
2236 },
2237 .display = {
2238 .bandwidth_update = &dce8_bandwidth_update,
2239 .get_vblank_counter = &evergreen_get_vblank_counter,
2240 .wait_for_vblank = &dce4_wait_for_vblank,
Samuel Li7272c9d2013-11-19 15:04:45 -05002241 .set_backlight_level = &atombios_set_backlight_level,
2242 .get_backlight_level = &atombios_get_backlight_level,
Alex Deucher0672e272013-04-09 16:22:31 -04002243 },
2244 .copy = {
Alex Deucher78196782013-12-09 17:38:51 -05002245 .blit = &cik_copy_cpdma,
Alex Deucher0672e272013-04-09 16:22:31 -04002246 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
2247 .dma = &cik_copy_dma,
2248 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
2249 .copy = &cik_copy_dma,
2250 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
2251 },
2252 .surface = {
2253 .set_reg = r600_set_surface_reg,
2254 .clear_reg = r600_clear_surface_reg,
2255 },
2256 .hpd = {
2257 .init = &evergreen_hpd_init,
2258 .fini = &evergreen_hpd_fini,
2259 .sense = &evergreen_hpd_sense,
2260 .set_polarity = &evergreen_hpd_set_polarity,
2261 },
2262 .pm = {
2263 .misc = &evergreen_pm_misc,
2264 .prepare = &evergreen_pm_prepare,
2265 .finish = &evergreen_pm_finish,
2266 .init_profile = &sumo_pm_init_profile,
2267 .get_dynpm_state = &r600_pm_get_dynpm_state,
2268 .get_engine_clock = &radeon_atom_get_engine_clock,
2269 .set_engine_clock = &radeon_atom_set_engine_clock,
2270 .get_memory_clock = &radeon_atom_get_memory_clock,
2271 .set_memory_clock = &radeon_atom_set_memory_clock,
2272 .get_pcie_lanes = NULL,
2273 .set_pcie_lanes = NULL,
2274 .set_clock_gating = NULL,
2275 .set_uvd_clocks = &cik_set_uvd_clocks,
Alex Deucher5ad6bf92013-08-22 17:09:06 -04002276 .set_vce_clocks = &cik_set_vce_clocks,
Alex Deucher286d9cc2013-06-21 15:50:47 -04002277 .get_temperature = &kv_get_temp,
Alex Deucher0672e272013-04-09 16:22:31 -04002278 },
Alex Deucher41a524a2013-08-14 01:01:40 -04002279 .dpm = {
2280 .init = &kv_dpm_init,
2281 .setup_asic = &kv_dpm_setup_asic,
2282 .enable = &kv_dpm_enable,
Alex Deucherd8852c32013-12-19 14:03:36 -05002283 .late_enable = &kv_dpm_late_enable,
Alex Deucher41a524a2013-08-14 01:01:40 -04002284 .disable = &kv_dpm_disable,
2285 .pre_set_power_state = &kv_dpm_pre_set_power_state,
2286 .set_power_state = &kv_dpm_set_power_state,
2287 .post_set_power_state = &kv_dpm_post_set_power_state,
2288 .display_configuration_changed = &kv_dpm_display_configuration_changed,
2289 .fini = &kv_dpm_fini,
2290 .get_sclk = &kv_dpm_get_sclk,
2291 .get_mclk = &kv_dpm_get_mclk,
2292 .print_power_state = &kv_dpm_print_power_state,
Alex Deucherae3e40e2013-07-18 16:39:53 -04002293 .debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level,
Alex Deucher2b4c8022013-07-18 16:48:46 -04002294 .force_performance_level = &kv_dpm_force_performance_level,
Alex Deucher77df5082013-08-09 10:02:40 -04002295 .powergate_uvd = &kv_dpm_powergate_uvd,
Alex Deucherb7a5ae92013-09-09 19:33:08 -04002296 .enable_bapm = &kv_dpm_enable_bapm,
Alex Deucher9b23bad2014-09-30 11:21:23 -04002297 .get_current_sclk = &kv_dpm_get_current_sclk,
2298 .get_current_mclk = &kv_dpm_get_current_mclk,
Alex Deucher41a524a2013-08-14 01:01:40 -04002299 },
Alex Deucher0672e272013-04-09 16:22:31 -04002300 .pflip = {
Alex Deucher0672e272013-04-09 16:22:31 -04002301 .page_flip = &evergreen_page_flip,
Christian König157fa142014-05-27 16:49:20 +02002302 .page_flip_pending = &evergreen_page_flip_pending,
Alex Deucher0672e272013-04-09 16:22:31 -04002303 },
2304};
2305
Alex Deucherabf1dc62012-07-17 14:02:36 -04002306/**
2307 * radeon_asic_init - register asic specific callbacks
2308 *
2309 * @rdev: radeon device pointer
2310 *
2311 * Registers the appropriate asic specific callbacks for each
2312 * chip family. Also sets other asics specific info like the number
2313 * of crtcs and the register aperture accessors (all asics).
2314 * Returns 0 for success.
2315 */
Daniel Vetter0a10c852010-03-11 21:19:14 +00002316int radeon_asic_init(struct radeon_device *rdev)
2317{
2318 radeon_register_accessor_init(rdev);
Alex Deucherba7e05e2011-06-16 18:14:22 +00002319
2320 /* set the number of crtcs */
2321 if (rdev->flags & RADEON_SINGLE_CRTC)
2322 rdev->num_crtc = 1;
2323 else
2324 rdev->num_crtc = 2;
2325
Alex Deucher948bee32013-05-14 12:08:35 -04002326 rdev->has_uvd = false;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002327 rdev->has_vce = false;
Alex Deucher948bee32013-05-14 12:08:35 -04002328
Daniel Vetter0a10c852010-03-11 21:19:14 +00002329 switch (rdev->family) {
2330 case CHIP_R100:
2331 case CHIP_RV100:
2332 case CHIP_RS100:
2333 case CHIP_RV200:
2334 case CHIP_RS200:
2335 rdev->asic = &r100_asic;
2336 break;
2337 case CHIP_R200:
2338 case CHIP_RV250:
2339 case CHIP_RS300:
2340 case CHIP_RV280:
2341 rdev->asic = &r200_asic;
2342 break;
2343 case CHIP_R300:
2344 case CHIP_R350:
2345 case CHIP_RV350:
2346 case CHIP_RV380:
2347 if (rdev->flags & RADEON_IS_PCIE)
2348 rdev->asic = &r300_asic_pcie;
2349 else
2350 rdev->asic = &r300_asic;
2351 break;
2352 case CHIP_R420:
2353 case CHIP_R423:
2354 case CHIP_RV410:
2355 rdev->asic = &r420_asic;
Alex Deucher07bb0842010-06-22 21:58:26 -04002356 /* handle macs */
2357 if (rdev->bios == NULL) {
Alex Deucher798bcf72012-02-23 17:53:48 -05002358 rdev->asic->pm.get_engine_clock = &radeon_legacy_get_engine_clock;
2359 rdev->asic->pm.set_engine_clock = &radeon_legacy_set_engine_clock;
2360 rdev->asic->pm.get_memory_clock = &radeon_legacy_get_memory_clock;
2361 rdev->asic->pm.set_memory_clock = NULL;
Alex Deucher37e9b6a2012-08-03 11:39:43 -04002362 rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level;
Alex Deucher07bb0842010-06-22 21:58:26 -04002363 }
Daniel Vetter0a10c852010-03-11 21:19:14 +00002364 break;
2365 case CHIP_RS400:
2366 case CHIP_RS480:
2367 rdev->asic = &rs400_asic;
2368 break;
2369 case CHIP_RS600:
2370 rdev->asic = &rs600_asic;
2371 break;
2372 case CHIP_RS690:
2373 case CHIP_RS740:
2374 rdev->asic = &rs690_asic;
2375 break;
2376 case CHIP_RV515:
2377 rdev->asic = &rv515_asic;
2378 break;
2379 case CHIP_R520:
2380 case CHIP_RV530:
2381 case CHIP_RV560:
2382 case CHIP_RV570:
2383 case CHIP_R580:
2384 rdev->asic = &r520_asic;
2385 break;
2386 case CHIP_R600:
Alex Deucherca361b62013-06-21 14:42:08 -04002387 rdev->asic = &r600_asic;
2388 break;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002389 case CHIP_RV610:
2390 case CHIP_RV630:
2391 case CHIP_RV620:
2392 case CHIP_RV635:
2393 case CHIP_RV670:
Alex Deucherca361b62013-06-21 14:42:08 -04002394 rdev->asic = &rv6xx_asic;
2395 rdev->has_uvd = true;
Alex Deucherf47299c2010-03-16 20:54:38 -04002396 break;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002397 case CHIP_RS780:
2398 case CHIP_RS880:
Alex Deucherf47299c2010-03-16 20:54:38 -04002399 rdev->asic = &rs780_asic;
Alex Deucherbdc99722014-08-26 13:11:36 -04002400 /* 760G/780V/880V don't have UVD */
2401 if ((rdev->pdev->device == 0x9616)||
2402 (rdev->pdev->device == 0x9611)||
2403 (rdev->pdev->device == 0x9613)||
2404 (rdev->pdev->device == 0x9711)||
2405 (rdev->pdev->device == 0x9713))
2406 rdev->has_uvd = false;
2407 else
2408 rdev->has_uvd = true;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002409 break;
2410 case CHIP_RV770:
2411 case CHIP_RV730:
2412 case CHIP_RV710:
2413 case CHIP_RV740:
2414 rdev->asic = &rv770_asic;
Alex Deucher948bee32013-05-14 12:08:35 -04002415 rdev->has_uvd = true;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002416 break;
2417 case CHIP_CEDAR:
2418 case CHIP_REDWOOD:
2419 case CHIP_JUNIPER:
2420 case CHIP_CYPRESS:
2421 case CHIP_HEMLOCK:
Alex Deucherba7e05e2011-06-16 18:14:22 +00002422 /* set num crtcs */
2423 if (rdev->family == CHIP_CEDAR)
2424 rdev->num_crtc = 4;
2425 else
2426 rdev->num_crtc = 6;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002427 rdev->asic = &evergreen_asic;
Alex Deucher948bee32013-05-14 12:08:35 -04002428 rdev->has_uvd = true;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002429 break;
Alex Deucher958261d2010-11-22 17:56:30 -05002430 case CHIP_PALM:
Alex Deucher89da5a32011-05-31 15:42:47 -04002431 case CHIP_SUMO:
2432 case CHIP_SUMO2:
Alex Deucher958261d2010-11-22 17:56:30 -05002433 rdev->asic = &sumo_asic;
Alex Deucher948bee32013-05-14 12:08:35 -04002434 rdev->has_uvd = true;
Alex Deucher958261d2010-11-22 17:56:30 -05002435 break;
Alex Deuchera43b7662011-01-06 21:19:33 -05002436 case CHIP_BARTS:
2437 case CHIP_TURKS:
2438 case CHIP_CAICOS:
Alex Deucherba7e05e2011-06-16 18:14:22 +00002439 /* set num crtcs */
2440 if (rdev->family == CHIP_CAICOS)
2441 rdev->num_crtc = 4;
2442 else
2443 rdev->num_crtc = 6;
Alex Deuchera43b7662011-01-06 21:19:33 -05002444 rdev->asic = &btc_asic;
Alex Deucher948bee32013-05-14 12:08:35 -04002445 rdev->has_uvd = true;
Alex Deuchera43b7662011-01-06 21:19:33 -05002446 break;
Alex Deuchere3487622011-03-02 20:07:36 -05002447 case CHIP_CAYMAN:
2448 rdev->asic = &cayman_asic;
Alex Deucherba7e05e2011-06-16 18:14:22 +00002449 /* set num crtcs */
2450 rdev->num_crtc = 6;
Alex Deucher948bee32013-05-14 12:08:35 -04002451 rdev->has_uvd = true;
Alex Deuchere3487622011-03-02 20:07:36 -05002452 break;
Alex Deucherbe63fe82012-03-20 17:18:40 -04002453 case CHIP_ARUBA:
2454 rdev->asic = &trinity_asic;
2455 /* set num crtcs */
2456 rdev->num_crtc = 4;
Alex Deucher948bee32013-05-14 12:08:35 -04002457 rdev->has_uvd = true;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002458 rdev->has_vce = true;
Alex Deucherd55a43a2015-05-11 22:01:54 +02002459 rdev->cg_flags =
2460 RADEON_CG_SUPPORT_VCE_MGCG;
Alex Deucherbe63fe82012-03-20 17:18:40 -04002461 break;
Alex Deucher02779c02012-03-20 17:18:25 -04002462 case CHIP_TAHITI:
2463 case CHIP_PITCAIRN:
2464 case CHIP_VERDE:
Alex Deuchere737a142012-08-30 14:00:03 -04002465 case CHIP_OLAND:
Alex Deucher86a45ca2012-07-26 19:04:20 -04002466 case CHIP_HAINAN:
Alex Deucher02779c02012-03-20 17:18:25 -04002467 rdev->asic = &si_asic;
2468 /* set num crtcs */
Alex Deucher86a45ca2012-07-26 19:04:20 -04002469 if (rdev->family == CHIP_HAINAN)
2470 rdev->num_crtc = 0;
2471 else if (rdev->family == CHIP_OLAND)
Alex Deuchere737a142012-08-30 14:00:03 -04002472 rdev->num_crtc = 2;
2473 else
2474 rdev->num_crtc = 6;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002475 if (rdev->family == CHIP_HAINAN) {
Alex Deucher948bee32013-05-14 12:08:35 -04002476 rdev->has_uvd = false;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002477 rdev->has_vce = false;
2478 } else {
Alex Deucher948bee32013-05-14 12:08:35 -04002479 rdev->has_uvd = true;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002480 rdev->has_vce = true;
2481 }
Alex Deucher0116e1e2013-08-08 18:00:10 -04002482 switch (rdev->family) {
2483 case CHIP_TAHITI:
2484 rdev->cg_flags =
Alex Deucher090f4b62013-08-14 18:53:56 -04002485 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher0116e1e2013-08-08 18:00:10 -04002486 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deuchere16866e2013-08-08 19:34:07 -04002487 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher0116e1e2013-08-08 18:00:10 -04002488 RADEON_CG_SUPPORT_GFX_CGLS |
2489 RADEON_CG_SUPPORT_GFX_CGTS |
2490 RADEON_CG_SUPPORT_GFX_CP_LS |
2491 RADEON_CG_SUPPORT_MC_MGCG |
2492 RADEON_CG_SUPPORT_SDMA_MGCG |
2493 RADEON_CG_SUPPORT_BIF_LS |
2494 RADEON_CG_SUPPORT_VCE_MGCG |
2495 RADEON_CG_SUPPORT_UVD_MGCG |
2496 RADEON_CG_SUPPORT_HDP_LS |
2497 RADEON_CG_SUPPORT_HDP_MGCG;
2498 rdev->pg_flags = 0;
2499 break;
2500 case CHIP_PITCAIRN:
2501 rdev->cg_flags =
Alex Deucher090f4b62013-08-14 18:53:56 -04002502 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher0116e1e2013-08-08 18:00:10 -04002503 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deuchere16866e2013-08-08 19:34:07 -04002504 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher0116e1e2013-08-08 18:00:10 -04002505 RADEON_CG_SUPPORT_GFX_CGLS |
2506 RADEON_CG_SUPPORT_GFX_CGTS |
2507 RADEON_CG_SUPPORT_GFX_CP_LS |
2508 RADEON_CG_SUPPORT_GFX_RLC_LS |
2509 RADEON_CG_SUPPORT_MC_LS |
2510 RADEON_CG_SUPPORT_MC_MGCG |
2511 RADEON_CG_SUPPORT_SDMA_MGCG |
2512 RADEON_CG_SUPPORT_BIF_LS |
2513 RADEON_CG_SUPPORT_VCE_MGCG |
2514 RADEON_CG_SUPPORT_UVD_MGCG |
2515 RADEON_CG_SUPPORT_HDP_LS |
2516 RADEON_CG_SUPPORT_HDP_MGCG;
2517 rdev->pg_flags = 0;
2518 break;
2519 case CHIP_VERDE:
2520 rdev->cg_flags =
Alex Deucher090f4b62013-08-14 18:53:56 -04002521 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher0116e1e2013-08-08 18:00:10 -04002522 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deuchere16866e2013-08-08 19:34:07 -04002523 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher0116e1e2013-08-08 18:00:10 -04002524 RADEON_CG_SUPPORT_GFX_CGLS |
2525 RADEON_CG_SUPPORT_GFX_CGTS |
2526 RADEON_CG_SUPPORT_GFX_CP_LS |
2527 RADEON_CG_SUPPORT_GFX_RLC_LS |
2528 RADEON_CG_SUPPORT_MC_LS |
2529 RADEON_CG_SUPPORT_MC_MGCG |
2530 RADEON_CG_SUPPORT_SDMA_MGCG |
2531 RADEON_CG_SUPPORT_BIF_LS |
2532 RADEON_CG_SUPPORT_VCE_MGCG |
2533 RADEON_CG_SUPPORT_UVD_MGCG |
2534 RADEON_CG_SUPPORT_HDP_LS |
2535 RADEON_CG_SUPPORT_HDP_MGCG;
Alex Deucherca6ebb32013-08-13 13:18:37 -04002536 rdev->pg_flags = 0 |
Alex Deucher2b19d172013-09-04 16:58:29 -04002537 /*RADEON_PG_SUPPORT_GFX_PG | */
Alex Deucherca6ebb32013-08-13 13:18:37 -04002538 RADEON_PG_SUPPORT_SDMA;
Alex Deucher0116e1e2013-08-08 18:00:10 -04002539 break;
2540 case CHIP_OLAND:
2541 rdev->cg_flags =
Alex Deucher090f4b62013-08-14 18:53:56 -04002542 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher0116e1e2013-08-08 18:00:10 -04002543 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deuchere16866e2013-08-08 19:34:07 -04002544 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher0116e1e2013-08-08 18:00:10 -04002545 RADEON_CG_SUPPORT_GFX_CGLS |
2546 RADEON_CG_SUPPORT_GFX_CGTS |
2547 RADEON_CG_SUPPORT_GFX_CP_LS |
2548 RADEON_CG_SUPPORT_GFX_RLC_LS |
2549 RADEON_CG_SUPPORT_MC_LS |
2550 RADEON_CG_SUPPORT_MC_MGCG |
2551 RADEON_CG_SUPPORT_SDMA_MGCG |
2552 RADEON_CG_SUPPORT_BIF_LS |
2553 RADEON_CG_SUPPORT_UVD_MGCG |
2554 RADEON_CG_SUPPORT_HDP_LS |
2555 RADEON_CG_SUPPORT_HDP_MGCG;
2556 rdev->pg_flags = 0;
2557 break;
2558 case CHIP_HAINAN:
2559 rdev->cg_flags =
Alex Deucher090f4b62013-08-14 18:53:56 -04002560 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher0116e1e2013-08-08 18:00:10 -04002561 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deuchere16866e2013-08-08 19:34:07 -04002562 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher0116e1e2013-08-08 18:00:10 -04002563 RADEON_CG_SUPPORT_GFX_CGLS |
2564 RADEON_CG_SUPPORT_GFX_CGTS |
2565 RADEON_CG_SUPPORT_GFX_CP_LS |
2566 RADEON_CG_SUPPORT_GFX_RLC_LS |
2567 RADEON_CG_SUPPORT_MC_LS |
2568 RADEON_CG_SUPPORT_MC_MGCG |
2569 RADEON_CG_SUPPORT_SDMA_MGCG |
2570 RADEON_CG_SUPPORT_BIF_LS |
2571 RADEON_CG_SUPPORT_HDP_LS |
2572 RADEON_CG_SUPPORT_HDP_MGCG;
2573 rdev->pg_flags = 0;
2574 break;
2575 default:
2576 rdev->cg_flags = 0;
2577 rdev->pg_flags = 0;
2578 break;
2579 }
Alex Deucher02779c02012-03-20 17:18:25 -04002580 break;
Alex Deucher0672e272013-04-09 16:22:31 -04002581 case CHIP_BONAIRE:
Alex Deucher41971b32013-08-19 18:02:26 -04002582 case CHIP_HAWAII:
Alex Deucher0672e272013-04-09 16:22:31 -04002583 rdev->asic = &ci_asic;
2584 rdev->num_crtc = 6;
Alex Deucher22c775c2013-07-23 09:41:05 -04002585 rdev->has_uvd = true;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002586 rdev->has_vce = true;
Alex Deucher41971b32013-08-19 18:02:26 -04002587 if (rdev->family == CHIP_BONAIRE) {
2588 rdev->cg_flags =
2589 RADEON_CG_SUPPORT_GFX_MGCG |
2590 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deucher69609482014-06-26 18:36:24 -04002591 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher41971b32013-08-19 18:02:26 -04002592 RADEON_CG_SUPPORT_GFX_CGLS |
2593 RADEON_CG_SUPPORT_GFX_CGTS |
2594 RADEON_CG_SUPPORT_GFX_CGTS_LS |
2595 RADEON_CG_SUPPORT_GFX_CP_LS |
2596 RADEON_CG_SUPPORT_MC_LS |
2597 RADEON_CG_SUPPORT_MC_MGCG |
2598 RADEON_CG_SUPPORT_SDMA_MGCG |
2599 RADEON_CG_SUPPORT_SDMA_LS |
2600 RADEON_CG_SUPPORT_BIF_LS |
2601 RADEON_CG_SUPPORT_VCE_MGCG |
2602 RADEON_CG_SUPPORT_UVD_MGCG |
2603 RADEON_CG_SUPPORT_HDP_LS |
2604 RADEON_CG_SUPPORT_HDP_MGCG;
2605 rdev->pg_flags = 0;
2606 } else {
2607 rdev->cg_flags =
2608 RADEON_CG_SUPPORT_GFX_MGCG |
2609 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deucher69609482014-06-26 18:36:24 -04002610 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher41971b32013-08-19 18:02:26 -04002611 RADEON_CG_SUPPORT_GFX_CGLS |
2612 RADEON_CG_SUPPORT_GFX_CGTS |
2613 RADEON_CG_SUPPORT_GFX_CP_LS |
2614 RADEON_CG_SUPPORT_MC_LS |
2615 RADEON_CG_SUPPORT_MC_MGCG |
2616 RADEON_CG_SUPPORT_SDMA_MGCG |
2617 RADEON_CG_SUPPORT_SDMA_LS |
2618 RADEON_CG_SUPPORT_BIF_LS |
2619 RADEON_CG_SUPPORT_VCE_MGCG |
2620 RADEON_CG_SUPPORT_UVD_MGCG |
2621 RADEON_CG_SUPPORT_HDP_LS |
2622 RADEON_CG_SUPPORT_HDP_MGCG;
2623 rdev->pg_flags = 0;
2624 }
Alex Deucher0672e272013-04-09 16:22:31 -04002625 break;
2626 case CHIP_KAVERI:
2627 case CHIP_KABINI:
Samuel Lib0a9f222014-04-30 18:40:48 -04002628 case CHIP_MULLINS:
Alex Deucher0672e272013-04-09 16:22:31 -04002629 rdev->asic = &kv_asic;
2630 /* set num crtcs */
Alex Deucher473359b2013-08-09 11:18:39 -04002631 if (rdev->family == CHIP_KAVERI) {
Alex Deucher0672e272013-04-09 16:22:31 -04002632 rdev->num_crtc = 4;
Alex Deucher473359b2013-08-09 11:18:39 -04002633 rdev->cg_flags =
Alex Deucher773dc102013-08-14 18:58:43 -04002634 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher473359b2013-08-09 11:18:39 -04002635 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deucher69609482014-06-26 18:36:24 -04002636 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher473359b2013-08-09 11:18:39 -04002637 RADEON_CG_SUPPORT_GFX_CGLS |
2638 RADEON_CG_SUPPORT_GFX_CGTS |
2639 RADEON_CG_SUPPORT_GFX_CGTS_LS |
2640 RADEON_CG_SUPPORT_GFX_CP_LS |
2641 RADEON_CG_SUPPORT_SDMA_MGCG |
2642 RADEON_CG_SUPPORT_SDMA_LS |
2643 RADEON_CG_SUPPORT_BIF_LS |
2644 RADEON_CG_SUPPORT_VCE_MGCG |
2645 RADEON_CG_SUPPORT_UVD_MGCG |
2646 RADEON_CG_SUPPORT_HDP_LS |
2647 RADEON_CG_SUPPORT_HDP_MGCG;
2648 rdev->pg_flags = 0;
Alex Deucher2b19d172013-09-04 16:58:29 -04002649 /*RADEON_PG_SUPPORT_GFX_PG |
Alex Deucher473359b2013-08-09 11:18:39 -04002650 RADEON_PG_SUPPORT_GFX_SMG |
2651 RADEON_PG_SUPPORT_GFX_DMG |
2652 RADEON_PG_SUPPORT_UVD |
2653 RADEON_PG_SUPPORT_VCE |
2654 RADEON_PG_SUPPORT_CP |
2655 RADEON_PG_SUPPORT_GDS |
2656 RADEON_PG_SUPPORT_RLC_SMU_HS |
2657 RADEON_PG_SUPPORT_ACP |
2658 RADEON_PG_SUPPORT_SAMU;*/
2659 } else {
Alex Deucher0672e272013-04-09 16:22:31 -04002660 rdev->num_crtc = 2;
Alex Deucher473359b2013-08-09 11:18:39 -04002661 rdev->cg_flags =
Alex Deucher773dc102013-08-14 18:58:43 -04002662 RADEON_CG_SUPPORT_GFX_MGCG |
Alex Deucher473359b2013-08-09 11:18:39 -04002663 RADEON_CG_SUPPORT_GFX_MGLS |
Alex Deucher69609482014-06-26 18:36:24 -04002664 /*RADEON_CG_SUPPORT_GFX_CGCG |*/
Alex Deucher473359b2013-08-09 11:18:39 -04002665 RADEON_CG_SUPPORT_GFX_CGLS |
2666 RADEON_CG_SUPPORT_GFX_CGTS |
2667 RADEON_CG_SUPPORT_GFX_CGTS_LS |
2668 RADEON_CG_SUPPORT_GFX_CP_LS |
2669 RADEON_CG_SUPPORT_SDMA_MGCG |
2670 RADEON_CG_SUPPORT_SDMA_LS |
2671 RADEON_CG_SUPPORT_BIF_LS |
2672 RADEON_CG_SUPPORT_VCE_MGCG |
2673 RADEON_CG_SUPPORT_UVD_MGCG |
2674 RADEON_CG_SUPPORT_HDP_LS |
2675 RADEON_CG_SUPPORT_HDP_MGCG;
2676 rdev->pg_flags = 0;
Alex Deucher2b19d172013-09-04 16:58:29 -04002677 /*RADEON_PG_SUPPORT_GFX_PG |
Alex Deucher473359b2013-08-09 11:18:39 -04002678 RADEON_PG_SUPPORT_GFX_SMG |
2679 RADEON_PG_SUPPORT_UVD |
2680 RADEON_PG_SUPPORT_VCE |
2681 RADEON_PG_SUPPORT_CP |
2682 RADEON_PG_SUPPORT_GDS |
2683 RADEON_PG_SUPPORT_RLC_SMU_HS |
2684 RADEON_PG_SUPPORT_SAMU;*/
2685 }
Alex Deucher22c775c2013-07-23 09:41:05 -04002686 rdev->has_uvd = true;
Jérome Glissee3ebfcf2016-03-18 16:58:32 +01002687 rdev->has_vce = true;
Alex Deucher0672e272013-04-09 16:22:31 -04002688 break;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002689 default:
2690 /* FIXME: not supported yet */
2691 return -EINVAL;
2692 }
2693
2694 if (rdev->flags & RADEON_IS_IGP) {
Alex Deucher798bcf72012-02-23 17:53:48 -05002695 rdev->asic->pm.get_memory_clock = NULL;
2696 rdev->asic->pm.set_memory_clock = NULL;
Daniel Vetter0a10c852010-03-11 21:19:14 +00002697 }
2698
Jérome Glissef1a0a672016-03-18 16:58:36 +01002699 if (!radeon_uvd)
2700 rdev->has_uvd = false;
Jérome Glissefabb5932016-03-18 16:58:37 +01002701 if (!radeon_vce)
2702 rdev->has_vce = false;
Jérome Glissef1a0a672016-03-18 16:58:36 +01002703
Daniel Vetter0a10c852010-03-11 21:19:14 +00002704 return 0;
2705}
2706