radeon_asic.c 76.9 KB
Newer Older
D
Daniel Vetter 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
/*
 * Copyright 2008 Advanced Micro Devices, Inc.
 * Copyright 2008 Red Hat Inc.
 * Copyright 2009 Jerome Glisse.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: Dave Airlie
 *          Alex Deucher
 *          Jerome Glisse
 */

#include <linux/console.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
#include <drm/radeon_drm.h>
#include <linux/vgaarb.h>
#include <linux/vga_switcheroo.h>
#include "radeon_reg.h"
#include "radeon.h"
#include "radeon_asic.h"
#include "atom.h"

/*
 * Registers accessors functions.
 */
43 44 45 46 47 48 49 50 51 52
/**
 * radeon_invalid_rreg - dummy reg read function
 *
 * @rdev: radeon device pointer
 * @reg: offset of register
 *
 * Dummy register read function.  Used for register blocks
 * that certain asics don't have (all asics).
 * Returns the value in the register.
 */
D
Daniel Vetter 已提交
53 54 55 56 57 58 59
static uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg)
{
	DRM_ERROR("Invalid callback to read register 0x%04X\n", reg);
	BUG_ON(1);
	return 0;
}

60 61 62 63 64 65 66 67 68 69
/**
 * radeon_invalid_wreg - dummy reg write function
 *
 * @rdev: radeon device pointer
 * @reg: offset of register
 * @v: value to write to the register
 *
 * Dummy register read function.  Used for register blocks
 * that certain asics don't have (all asics).
 */
D
Daniel Vetter 已提交
70 71 72 73 74 75 76
static void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
{
	DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n",
		  reg, v);
	BUG_ON(1);
}

77 78 79 80 81 82 83 84
/**
 * radeon_register_accessor_init - sets up the register accessor callbacks
 *
 * @rdev: radeon device pointer
 *
 * Sets up the register accessor callbacks for various register
 * apertures.  Not all asics have all apertures (all asics).
 */
D
Daniel Vetter 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
static void radeon_register_accessor_init(struct radeon_device *rdev)
{
	rdev->mc_rreg = &radeon_invalid_rreg;
	rdev->mc_wreg = &radeon_invalid_wreg;
	rdev->pll_rreg = &radeon_invalid_rreg;
	rdev->pll_wreg = &radeon_invalid_wreg;
	rdev->pciep_rreg = &radeon_invalid_rreg;
	rdev->pciep_wreg = &radeon_invalid_wreg;

	/* Don't change order as we are overridding accessor. */
	if (rdev->family < CHIP_RV515) {
		rdev->pcie_reg_mask = 0xff;
	} else {
		rdev->pcie_reg_mask = 0x7ff;
	}
	/* FIXME: not sure here */
	if (rdev->family <= CHIP_R580) {
		rdev->pll_rreg = &r100_pll_rreg;
		rdev->pll_wreg = &r100_pll_wreg;
	}
	if (rdev->family >= CHIP_R420) {
		rdev->mc_rreg = &r420_mc_rreg;
		rdev->mc_wreg = &r420_mc_wreg;
	}
	if (rdev->family >= CHIP_RV515) {
		rdev->mc_rreg = &rv515_mc_rreg;
		rdev->mc_wreg = &rv515_mc_wreg;
	}
	if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {
		rdev->mc_rreg = &rs400_mc_rreg;
		rdev->mc_wreg = &rs400_mc_wreg;
	}
	if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) {
		rdev->mc_rreg = &rs690_mc_rreg;
		rdev->mc_wreg = &rs690_mc_wreg;
	}
	if (rdev->family == CHIP_RS600) {
		rdev->mc_rreg = &rs600_mc_rreg;
		rdev->mc_wreg = &rs600_mc_wreg;
	}
125 126 127 128
	if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) {
		rdev->mc_rreg = &rs780_mc_rreg;
		rdev->mc_wreg = &rs780_mc_wreg;
	}
129 130 131 132 133

	if (rdev->family >= CHIP_BONAIRE) {
		rdev->pciep_rreg = &cik_pciep_rreg;
		rdev->pciep_wreg = &cik_pciep_wreg;
	} else if (rdev->family >= CHIP_R600) {
D
Daniel Vetter 已提交
134 135 136 137 138 139 140
		rdev->pciep_rreg = &r600_pciep_rreg;
		rdev->pciep_wreg = &r600_pciep_wreg;
	}
}


/* helper to disable agp */
141 142 143 144 145 146 147 148
/**
 * radeon_agp_disable - AGP disable helper function
 *
 * @rdev: radeon device pointer
 *
 * Removes AGP flags and changes the gart callbacks on AGP
 * cards when using the internal gart rather than AGP (all asics).
 */
D
Daniel Vetter 已提交
149 150 151 152 153 154 155 156 157 158 159 160
void radeon_agp_disable(struct radeon_device *rdev)
{
	rdev->flags &= ~RADEON_IS_AGP;
	if (rdev->family >= CHIP_R600) {
		DRM_INFO("Forcing AGP to PCIE mode\n");
		rdev->flags |= RADEON_IS_PCIE;
	} else if (rdev->family >= CHIP_RV515 ||
			rdev->family == CHIP_RV380 ||
			rdev->family == CHIP_RV410 ||
			rdev->family == CHIP_R423) {
		DRM_INFO("Forcing AGP to PCIE mode\n");
		rdev->flags |= RADEON_IS_PCIE;
161 162
		rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
		rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
D
Daniel Vetter 已提交
163 164 165
	} else {
		DRM_INFO("Forcing AGP to PCI mode\n");
		rdev->flags |= RADEON_IS_PCI;
166 167
		rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
		rdev->asic->gart.set_page = &r100_pci_gart_set_page;
D
Daniel Vetter 已提交
168 169 170 171 172 173 174
	}
	rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
}

/*
 * ASIC
 */
175 176 177 178 179 180 181 182 183 184

static struct radeon_asic_ring r100_gfx_ring = {
	.ib_execute = &r100_ring_ib_execute,
	.emit_fence = &r100_fence_ring_emit,
	.emit_semaphore = &r100_semaphore_ring_emit,
	.cs_parse = &r100_cs_parse,
	.ring_start = &r100_ring_start,
	.ring_test = &r100_ring_test,
	.ib_test = &r100_ib_test,
	.is_lockup = &r100_gpu_is_lockup,
185 186 187
	.get_rptr = &r100_gfx_get_rptr,
	.get_wptr = &r100_gfx_get_wptr,
	.set_wptr = &r100_gfx_set_wptr,
188
	.hdp_flush = &r100_ring_hdp_flush,
189 190
};

191 192 193 194 195 196
static struct radeon_asic r100_asic = {
	.init = &r100_init,
	.fini = &r100_fini,
	.suspend = &r100_suspend,
	.resume = &r100_resume,
	.vga_set_state = &r100_vga_set_state,
197
	.asic_reset = &r100_asic_reset,
198
	.mmio_hdp_flush = NULL,
199 200
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
201 202 203 204
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
205
	.ring = {
206
		[RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
207
	},
208 209 210 211
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
212 213 214 215
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
216
		.set_backlight_level = &radeon_legacy_set_backlight_level,
217
		.get_backlight_level = &radeon_legacy_get_backlight_level,
218
	},
219 220 221 222 223 224 225 226
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = NULL,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
227 228 229 230
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
231 232 233 234 235 236
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
237 238 239 240 241 242
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
243 244 245 246 247 248 249
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
250
	},
251 252
	.pflip = {
		.page_flip = &r100_page_flip,
253
		.page_flip_pending = &r100_page_flip_pending,
254
	},
255 256 257 258 259 260 261 262
};

static struct radeon_asic r200_asic = {
	.init = &r100_init,
	.fini = &r100_fini,
	.suspend = &r100_suspend,
	.resume = &r100_resume,
	.vga_set_state = &r100_vga_set_state,
263
	.asic_reset = &r100_asic_reset,
264
	.mmio_hdp_flush = NULL,
265 266
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
267 268 269 270
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
271
	.ring = {
272
		[RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
273
	},
274 275 276 277
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
278 279 280 281
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
282
		.set_backlight_level = &radeon_legacy_set_backlight_level,
283
		.get_backlight_level = &radeon_legacy_get_backlight_level,
284
	},
285 286 287 288 289 290 291 292
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
293 294 295 296
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
297 298 299 300 301 302
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
303 304 305 306 307 308
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
309 310 311 312 313 314 315
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
316
	},
317 318
	.pflip = {
		.page_flip = &r100_page_flip,
319
		.page_flip_pending = &r100_page_flip_pending,
320
	},
321 322
};

323 324 325 326 327 328 329 330 331
static struct radeon_asic_ring r300_gfx_ring = {
	.ib_execute = &r100_ring_ib_execute,
	.emit_fence = &r300_fence_ring_emit,
	.emit_semaphore = &r100_semaphore_ring_emit,
	.cs_parse = &r300_cs_parse,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
	.ib_test = &r100_ib_test,
	.is_lockup = &r100_gpu_is_lockup,
332 333 334
	.get_rptr = &r100_gfx_get_rptr,
	.get_wptr = &r100_gfx_get_wptr,
	.set_wptr = &r100_gfx_set_wptr,
335
	.hdp_flush = &r100_ring_hdp_flush,
336 337
};

338 339 340 341 342 343
static struct radeon_asic r300_asic = {
	.init = &r300_init,
	.fini = &r300_fini,
	.suspend = &r300_suspend,
	.resume = &r300_resume,
	.vga_set_state = &r100_vga_set_state,
344
	.asic_reset = &r300_asic_reset,
345
	.mmio_hdp_flush = NULL,
346 347
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
348 349 350 351
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
352
	.ring = {
353
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
354
	},
355 356 357 358
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
359 360 361 362
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
363
		.set_backlight_level = &radeon_legacy_set_backlight_level,
364
		.get_backlight_level = &radeon_legacy_get_backlight_level,
365
	},
366 367 368 369 370 371 372 373
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
374 375 376 377
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
378 379 380 381 382 383
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
384 385 386 387 388 389
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
390 391 392 393 394 395 396
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
397
	},
398 399
	.pflip = {
		.page_flip = &r100_page_flip,
400
		.page_flip_pending = &r100_page_flip_pending,
401
	},
402 403 404 405 406 407 408 409
};

static struct radeon_asic r300_asic_pcie = {
	.init = &r300_init,
	.fini = &r300_fini,
	.suspend = &r300_suspend,
	.resume = &r300_resume,
	.vga_set_state = &r100_vga_set_state,
410
	.asic_reset = &r300_asic_reset,
411
	.mmio_hdp_flush = NULL,
412 413
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
414 415 416 417
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
418
	.ring = {
419
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
420
	},
421 422 423 424
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
425 426 427 428
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
429
		.set_backlight_level = &radeon_legacy_set_backlight_level,
430
		.get_backlight_level = &radeon_legacy_get_backlight_level,
431
	},
432 433 434 435 436 437 438 439
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
440 441 442 443
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
444 445 446 447 448 449
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
450 451 452 453 454 455
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
456 457 458 459 460 461 462
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
463
	},
464 465
	.pflip = {
		.page_flip = &r100_page_flip,
466
		.page_flip_pending = &r100_page_flip_pending,
467
	},
468 469 470 471 472 473 474 475
};

static struct radeon_asic r420_asic = {
	.init = &r420_init,
	.fini = &r420_fini,
	.suspend = &r420_suspend,
	.resume = &r420_resume,
	.vga_set_state = &r100_vga_set_state,
476
	.asic_reset = &r300_asic_reset,
477
	.mmio_hdp_flush = NULL,
478 479
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
480 481 482 483
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
484
	.ring = {
485
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
486
	},
487 488 489 490
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
491 492 493 494
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
495
		.set_backlight_level = &atombios_set_backlight_level,
496
		.get_backlight_level = &atombios_get_backlight_level,
497
	},
498 499 500 501 502 503 504 505
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
506 507 508 509
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
510 511 512 513 514 515
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
516 517 518 519 520 521
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r420_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
522 523 524 525 526 527 528
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_atom_set_clock_gating,
529
	},
530 531
	.pflip = {
		.page_flip = &r100_page_flip,
532
		.page_flip_pending = &r100_page_flip_pending,
533
	},
534 535 536 537 538 539 540 541
};

static struct radeon_asic rs400_asic = {
	.init = &rs400_init,
	.fini = &rs400_fini,
	.suspend = &rs400_suspend,
	.resume = &rs400_resume,
	.vga_set_state = &r100_vga_set_state,
542
	.asic_reset = &r300_asic_reset,
543
	.mmio_hdp_flush = NULL,
544 545
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs400_mc_wait_for_idle,
546 547 548 549
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
550
	.ring = {
551
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
552
	},
553 554 555 556
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
557 558 559 560
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
561
		.set_backlight_level = &radeon_legacy_set_backlight_level,
562
		.get_backlight_level = &radeon_legacy_get_backlight_level,
563
	},
564 565 566 567 568 569 570 571
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
572 573 574 575
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
576 577 578 579 580 581
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
582 583 584 585 586 587
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
588 589 590 591 592 593 594
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
595
	},
596 597
	.pflip = {
		.page_flip = &r100_page_flip,
598
		.page_flip_pending = &r100_page_flip_pending,
599
	},
600 601 602 603 604 605 606 607
};

static struct radeon_asic rs600_asic = {
	.init = &rs600_init,
	.fini = &rs600_fini,
	.suspend = &rs600_suspend,
	.resume = &rs600_resume,
	.vga_set_state = &r100_vga_set_state,
608
	.asic_reset = &rs600_asic_reset,
609
	.mmio_hdp_flush = NULL,
610 611
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs600_mc_wait_for_idle,
612 613 614 615
	.gart = {
		.tlb_flush = &rs600_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
616
	.ring = {
617
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
618
	},
619 620 621 622
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
623 624 625 626
	.display = {
		.bandwidth_update = &rs600_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
627
		.set_backlight_level = &atombios_set_backlight_level,
628
		.get_backlight_level = &atombios_get_backlight_level,
629 630
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
631
	},
632 633 634 635 636 637 638 639
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
640 641 642 643
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
644 645 646 647 648 649
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
650 651 652 653 654 655
	.pm = {
		.misc = &rs600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r420_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
656 657 658 659 660 661 662
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = &radeon_atom_set_clock_gating,
663
	},
664 665
	.pflip = {
		.page_flip = &rs600_page_flip,
666
		.page_flip_pending = &rs600_page_flip_pending,
667
	},
668 669 670 671 672 673 674 675
};

static struct radeon_asic rs690_asic = {
	.init = &rs690_init,
	.fini = &rs690_fini,
	.suspend = &rs690_suspend,
	.resume = &rs690_resume,
	.vga_set_state = &r100_vga_set_state,
676
	.asic_reset = &rs600_asic_reset,
677
	.mmio_hdp_flush = NULL,
678 679
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs690_mc_wait_for_idle,
680 681 682 683
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
684
	.ring = {
685
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
686
	},
687 688 689 690
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
691 692 693 694
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rs690_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
695
		.set_backlight_level = &atombios_set_backlight_level,
696
		.get_backlight_level = &atombios_get_backlight_level,
697 698
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
699
	},
700 701 702 703 704 705 706 707
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r200_copy_dma,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
708 709 710 711
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
712 713 714 715 716 717
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
718 719 720 721 722 723
	.pm = {
		.misc = &rs600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r420_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
724 725 726 727 728 729 730
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = &radeon_atom_set_clock_gating,
731
	},
732 733
	.pflip = {
		.page_flip = &rs600_page_flip,
734
		.page_flip_pending = &rs600_page_flip_pending,
735
	},
736 737 738 739 740 741 742 743
};

static struct radeon_asic rv515_asic = {
	.init = &rv515_init,
	.fini = &rv515_fini,
	.suspend = &rv515_suspend,
	.resume = &rv515_resume,
	.vga_set_state = &r100_vga_set_state,
744
	.asic_reset = &rs600_asic_reset,
745
	.mmio_hdp_flush = NULL,
746 747
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rv515_mc_wait_for_idle,
748 749 750 751
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
752
	.ring = {
753
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
754
	},
755 756 757 758
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
759 760 761 762
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rv515_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
763
		.set_backlight_level = &atombios_set_backlight_level,
764
		.get_backlight_level = &atombios_get_backlight_level,
765
	},
766 767 768 769 770 771 772 773
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
774 775 776 777
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
778 779 780 781 782 783
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
784 785 786 787 788 789
	.pm = {
		.misc = &rs600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r420_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
790 791 792 793 794 795 796
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_atom_set_clock_gating,
797
	},
798 799
	.pflip = {
		.page_flip = &rs600_page_flip,
800
		.page_flip_pending = &rs600_page_flip_pending,
801
	},
802 803 804 805 806 807 808 809
};

static struct radeon_asic r520_asic = {
	.init = &r520_init,
	.fini = &rv515_fini,
	.suspend = &rv515_suspend,
	.resume = &r520_resume,
	.vga_set_state = &r100_vga_set_state,
810
	.asic_reset = &rs600_asic_reset,
811
	.mmio_hdp_flush = NULL,
812 813
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r520_mc_wait_for_idle,
814 815 816 817
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
818
	.ring = {
819
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
820
	},
821 822 823 824
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
825 826 827 828
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
829
		.set_backlight_level = &atombios_set_backlight_level,
830
		.get_backlight_level = &atombios_get_backlight_level,
831
	},
832 833 834 835 836 837 838 839
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
840 841 842 843
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
844 845 846 847 848 849
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
850 851 852 853 854 855
	.pm = {
		.misc = &rs600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r420_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
856 857 858 859 860 861 862
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_atom_set_clock_gating,
863
	},
864 865
	.pflip = {
		.page_flip = &rs600_page_flip,
866
		.page_flip_pending = &rs600_page_flip_pending,
867
	},
868 869
};

870 871 872 873 874 875 876 877
static struct radeon_asic_ring r600_gfx_ring = {
	.ib_execute = &r600_ring_ib_execute,
	.emit_fence = &r600_fence_ring_emit,
	.emit_semaphore = &r600_semaphore_ring_emit,
	.cs_parse = &r600_cs_parse,
	.ring_test = &r600_ring_test,
	.ib_test = &r600_ib_test,
	.is_lockup = &r600_gfx_is_lockup,
878 879 880
	.get_rptr = &r600_gfx_get_rptr,
	.get_wptr = &r600_gfx_get_wptr,
	.set_wptr = &r600_gfx_set_wptr,
881 882 883 884 885 886 887 888 889 890
};

static struct radeon_asic_ring r600_dma_ring = {
	.ib_execute = &r600_dma_ring_ib_execute,
	.emit_fence = &r600_dma_fence_ring_emit,
	.emit_semaphore = &r600_dma_semaphore_ring_emit,
	.cs_parse = &r600_dma_cs_parse,
	.ring_test = &r600_dma_ring_test,
	.ib_test = &r600_dma_ib_test,
	.is_lockup = &r600_dma_is_lockup,
891 892 893
	.get_rptr = &r600_dma_get_rptr,
	.get_wptr = &r600_dma_get_wptr,
	.set_wptr = &r600_dma_set_wptr,
894 895
};

896 897 898 899 900 901
static struct radeon_asic r600_asic = {
	.init = &r600_init,
	.fini = &r600_fini,
	.suspend = &r600_suspend,
	.resume = &r600_resume,
	.vga_set_state = &r600_vga_set_state,
902
	.asic_reset = &r600_asic_reset,
903
	.mmio_hdp_flush = r600_mmio_hdp_flush,
904 905
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
906
	.get_xclk = &r600_get_xclk,
907
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
908 909 910 911
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
912
	.ring = {
913 914
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
915
	},
916 917 918 919
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
920 921 922 923
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
924
		.set_backlight_level = &atombios_set_backlight_level,
925
		.get_backlight_level = &atombios_get_backlight_level,
926 927
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
928
	},
929
	.copy = {
930
		.blit = &r600_copy_cpdma,
931
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
932 933
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
934
		.copy = &r600_copy_cpdma,
935
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
936
	},
937 938 939 940
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
941 942 943 944 945 946
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
947 948 949 950 951 952
	.pm = {
		.misc = &r600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r600_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
953 954 955 956 957 958 959
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
		.set_clock_gating = NULL,
960
		.get_temperature = &rv6xx_get_temp,
961
	},
962 963
	.pflip = {
		.page_flip = &rs600_page_flip,
964
		.page_flip_pending = &rs600_page_flip_pending,
965
	},
966 967
};

968 969 970 971 972 973 974
static struct radeon_asic rv6xx_asic = {
	.init = &r600_init,
	.fini = &r600_fini,
	.suspend = &r600_suspend,
	.resume = &r600_resume,
	.vga_set_state = &r600_vga_set_state,
	.asic_reset = &r600_asic_reset,
975
	.mmio_hdp_flush = r600_mmio_hdp_flush,
976 977 978 979 980 981 982 983 984
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
	.get_xclk = &r600_get_xclk,
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.ring = {
985 986
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
987 988 989 990 991 992 993 994 995 996 997
	},
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
		.set_backlight_level = &atombios_set_backlight_level,
		.get_backlight_level = &atombios_get_backlight_level,
998 999
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
1000 1001
	},
	.copy = {
1002
		.blit = &r600_copy_cpdma,
1003 1004 1005
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1006
		.copy = &r600_copy_cpdma,
1007
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032
	},
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
	.pm = {
		.misc = &r600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r600_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
		.set_clock_gating = NULL,
		.get_temperature = &rv6xx_get_temp,
1033
		.set_uvd_clocks = &r600_set_uvd_clocks,
1034
	},
1035 1036 1037 1038
	.dpm = {
		.init = &rv6xx_dpm_init,
		.setup_asic = &rv6xx_setup_asic,
		.enable = &rv6xx_dpm_enable,
1039
		.late_enable = &r600_dpm_late_enable,
1040
		.disable = &rv6xx_dpm_disable,
1041
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1042
		.set_power_state = &rv6xx_dpm_set_power_state,
1043
		.post_set_power_state = &r600_dpm_post_set_power_state,
1044 1045 1046 1047 1048
		.display_configuration_changed = &rv6xx_dpm_display_configuration_changed,
		.fini = &rv6xx_dpm_fini,
		.get_sclk = &rv6xx_dpm_get_sclk,
		.get_mclk = &rv6xx_dpm_get_mclk,
		.print_power_state = &rv6xx_dpm_print_power_state,
1049
		.debugfs_print_current_performance_level = &rv6xx_dpm_debugfs_print_current_performance_level,
1050
		.force_performance_level = &rv6xx_dpm_force_performance_level,
1051
	},
1052 1053
	.pflip = {
		.page_flip = &rs600_page_flip,
1054
		.page_flip_pending = &rs600_page_flip_pending,
1055 1056 1057
	},
};

1058 1059 1060 1061 1062 1063
static struct radeon_asic rs780_asic = {
	.init = &r600_init,
	.fini = &r600_fini,
	.suspend = &r600_suspend,
	.resume = &r600_resume,
	.vga_set_state = &r600_vga_set_state,
1064
	.asic_reset = &r600_asic_reset,
1065
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1066 1067
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1068
	.get_xclk = &r600_get_xclk,
1069
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1070 1071 1072 1073
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1074
	.ring = {
1075 1076
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
1077
	},
1078 1079 1080 1081
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1082 1083 1084 1085
	.display = {
		.bandwidth_update = &rs690_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1086
		.set_backlight_level = &atombios_set_backlight_level,
1087
		.get_backlight_level = &atombios_get_backlight_level,
1088 1089
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
1090
	},
1091
	.copy = {
1092
		.blit = &r600_copy_cpdma,
1093
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1094 1095
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1096
		.copy = &r600_copy_cpdma,
1097
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1098
	},
1099 1100 1101 1102
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1103 1104 1105 1106 1107 1108
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1109 1110 1111 1112 1113 1114
	.pm = {
		.misc = &r600_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &rs780_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1115 1116 1117 1118 1119 1120 1121
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = NULL,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = NULL,
1122
		.get_temperature = &rv6xx_get_temp,
1123
		.set_uvd_clocks = &r600_set_uvd_clocks,
1124
	},
1125 1126 1127 1128
	.dpm = {
		.init = &rs780_dpm_init,
		.setup_asic = &rs780_dpm_setup_asic,
		.enable = &rs780_dpm_enable,
1129
		.late_enable = &r600_dpm_late_enable,
1130
		.disable = &rs780_dpm_disable,
1131
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1132
		.set_power_state = &rs780_dpm_set_power_state,
1133
		.post_set_power_state = &r600_dpm_post_set_power_state,
1134 1135 1136 1137 1138
		.display_configuration_changed = &rs780_dpm_display_configuration_changed,
		.fini = &rs780_dpm_fini,
		.get_sclk = &rs780_dpm_get_sclk,
		.get_mclk = &rs780_dpm_get_mclk,
		.print_power_state = &rs780_dpm_print_power_state,
1139
		.debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level,
1140
		.force_performance_level = &rs780_dpm_force_performance_level,
1141
	},
1142 1143
	.pflip = {
		.page_flip = &rs600_page_flip,
1144
		.page_flip_pending = &rs600_page_flip_pending,
1145
	},
1146 1147
};

1148
static struct radeon_asic_ring rv770_uvd_ring = {
1149 1150 1151
	.ib_execute = &uvd_v1_0_ib_execute,
	.emit_fence = &uvd_v2_2_fence_emit,
	.emit_semaphore = &uvd_v1_0_semaphore_emit,
1152
	.cs_parse = &radeon_uvd_cs_parse,
1153 1154
	.ring_test = &uvd_v1_0_ring_test,
	.ib_test = &uvd_v1_0_ib_test,
1155
	.is_lockup = &radeon_ring_test_lockup,
1156 1157 1158
	.get_rptr = &uvd_v1_0_get_rptr,
	.get_wptr = &uvd_v1_0_get_wptr,
	.set_wptr = &uvd_v1_0_set_wptr,
1159 1160
};

1161 1162 1163 1164 1165
static struct radeon_asic rv770_asic = {
	.init = &rv770_init,
	.fini = &rv770_fini,
	.suspend = &rv770_suspend,
	.resume = &rv770_resume,
1166
	.asic_reset = &r600_asic_reset,
1167
	.vga_set_state = &r600_vga_set_state,
1168
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1169 1170
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1171
	.get_xclk = &rv770_get_xclk,
1172
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1173 1174 1175 1176
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1177
	.ring = {
1178 1179 1180
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1181
	},
1182 1183 1184 1185
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1186 1187 1188 1189
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1190
		.set_backlight_level = &atombios_set_backlight_level,
1191
		.get_backlight_level = &atombios_get_backlight_level,
1192
		.hdmi_enable = &r600_hdmi_enable,
1193
		.hdmi_setmode = &dce3_1_hdmi_setmode,
1194
	},
1195
	.copy = {
1196
		.blit = &r600_copy_cpdma,
1197
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1198
		.dma = &rv770_copy_dma,
1199
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1200
		.copy = &rv770_copy_dma,
1201
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1202
	},
1203 1204 1205 1206
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1207 1208 1209 1210 1211 1212
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1213 1214 1215 1216 1217 1218
	.pm = {
		.misc = &rv770_pm_misc,
		.prepare = &rs600_pm_prepare,
		.finish = &rs600_pm_finish,
		.init_profile = &r600_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1219 1220 1221 1222 1223 1224 1225
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
		.set_clock_gating = &radeon_atom_set_clock_gating,
1226
		.set_uvd_clocks = &rv770_set_uvd_clocks,
1227
		.get_temperature = &rv770_get_temp,
1228
	},
1229 1230 1231 1232
	.dpm = {
		.init = &rv770_dpm_init,
		.setup_asic = &rv770_dpm_setup_asic,
		.enable = &rv770_dpm_enable,
1233
		.late_enable = &rv770_dpm_late_enable,
1234
		.disable = &rv770_dpm_disable,
1235
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1236
		.set_power_state = &rv770_dpm_set_power_state,
1237
		.post_set_power_state = &r600_dpm_post_set_power_state,
1238 1239 1240 1241 1242
		.display_configuration_changed = &rv770_dpm_display_configuration_changed,
		.fini = &rv770_dpm_fini,
		.get_sclk = &rv770_dpm_get_sclk,
		.get_mclk = &rv770_dpm_get_mclk,
		.print_power_state = &rv770_dpm_print_power_state,
1243
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1244
		.force_performance_level = &rv770_dpm_force_performance_level,
1245
		.vblank_too_short = &rv770_dpm_vblank_too_short,
1246
	},
1247 1248
	.pflip = {
		.page_flip = &rv770_page_flip,
1249
		.page_flip_pending = &rv770_page_flip_pending,
1250
	},
1251 1252
};

1253 1254 1255 1256 1257 1258 1259 1260
static struct radeon_asic_ring evergreen_gfx_ring = {
	.ib_execute = &evergreen_ring_ib_execute,
	.emit_fence = &r600_fence_ring_emit,
	.emit_semaphore = &r600_semaphore_ring_emit,
	.cs_parse = &evergreen_cs_parse,
	.ring_test = &r600_ring_test,
	.ib_test = &r600_ib_test,
	.is_lockup = &evergreen_gfx_is_lockup,
1261 1262 1263
	.get_rptr = &r600_gfx_get_rptr,
	.get_wptr = &r600_gfx_get_wptr,
	.set_wptr = &r600_gfx_set_wptr,
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
};

static struct radeon_asic_ring evergreen_dma_ring = {
	.ib_execute = &evergreen_dma_ring_ib_execute,
	.emit_fence = &evergreen_dma_fence_ring_emit,
	.emit_semaphore = &r600_dma_semaphore_ring_emit,
	.cs_parse = &evergreen_dma_cs_parse,
	.ring_test = &r600_dma_ring_test,
	.ib_test = &r600_dma_ib_test,
	.is_lockup = &evergreen_dma_is_lockup,
1274 1275 1276
	.get_rptr = &r600_dma_get_rptr,
	.get_wptr = &r600_dma_get_wptr,
	.set_wptr = &r600_dma_set_wptr,
1277 1278
};

1279 1280 1281 1282 1283
static struct radeon_asic evergreen_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
1284
	.asic_reset = &evergreen_asic_reset,
1285
	.vga_set_state = &r600_vga_set_state,
1286
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1287 1288
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1289
	.get_xclk = &rv770_get_xclk,
1290
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1291 1292 1293 1294
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1295
	.ring = {
1296 1297 1298
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1299
	},
1300 1301 1302 1303
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1304 1305 1306 1307
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1308
		.set_backlight_level = &atombios_set_backlight_level,
1309
		.get_backlight_level = &atombios_get_backlight_level,
1310 1311
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1312
	},
1313
	.copy = {
1314
		.blit = &r600_copy_cpdma,
1315
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1316 1317
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1318 1319
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1320
	},
1321 1322 1323 1324
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1325 1326 1327 1328 1329 1330
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1331 1332 1333 1334 1335 1336
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &r600_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1337 1338 1339 1340 1341 1342 1343
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
		.set_clock_gating = NULL,
1344
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1345
		.get_temperature = &evergreen_get_temp,
1346
	},
1347 1348 1349 1350
	.dpm = {
		.init = &cypress_dpm_init,
		.setup_asic = &cypress_dpm_setup_asic,
		.enable = &cypress_dpm_enable,
1351
		.late_enable = &rv770_dpm_late_enable,
1352
		.disable = &cypress_dpm_disable,
1353
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1354
		.set_power_state = &cypress_dpm_set_power_state,
1355
		.post_set_power_state = &r600_dpm_post_set_power_state,
1356 1357 1358 1359 1360
		.display_configuration_changed = &cypress_dpm_display_configuration_changed,
		.fini = &cypress_dpm_fini,
		.get_sclk = &rv770_dpm_get_sclk,
		.get_mclk = &rv770_dpm_get_mclk,
		.print_power_state = &rv770_dpm_print_power_state,
1361
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1362
		.force_performance_level = &rv770_dpm_force_performance_level,
1363
		.vblank_too_short = &cypress_dpm_vblank_too_short,
1364
	},
1365 1366
	.pflip = {
		.page_flip = &evergreen_page_flip,
1367
		.page_flip_pending = &evergreen_page_flip_pending,
1368
	},
1369 1370
};

1371 1372 1373 1374 1375 1376 1377
static struct radeon_asic sumo_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
	.asic_reset = &evergreen_asic_reset,
	.vga_set_state = &r600_vga_set_state,
1378
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1379 1380
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1381
	.get_xclk = &r600_get_xclk,
1382
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1383 1384 1385 1386
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1387
	.ring = {
1388 1389 1390
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1391
	},
1392 1393 1394 1395
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1396 1397 1398 1399
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1400
		.set_backlight_level = &atombios_set_backlight_level,
1401
		.get_backlight_level = &atombios_get_backlight_level,
1402 1403
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1404
	},
1405
	.copy = {
1406
		.blit = &r600_copy_cpdma,
1407
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1408 1409
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1410 1411
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1412
	},
1413 1414 1415 1416
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1417 1418 1419 1420 1421 1422
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1423 1424 1425 1426 1427 1428
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &sumo_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1429 1430 1431 1432 1433 1434 1435
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = NULL,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = NULL,
1436
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1437
		.get_temperature = &sumo_get_temp,
1438
	},
1439 1440 1441 1442
	.dpm = {
		.init = &sumo_dpm_init,
		.setup_asic = &sumo_dpm_setup_asic,
		.enable = &sumo_dpm_enable,
1443
		.late_enable = &sumo_dpm_late_enable,
1444
		.disable = &sumo_dpm_disable,
1445
		.pre_set_power_state = &sumo_dpm_pre_set_power_state,
1446
		.set_power_state = &sumo_dpm_set_power_state,
1447
		.post_set_power_state = &sumo_dpm_post_set_power_state,
1448 1449 1450 1451 1452
		.display_configuration_changed = &sumo_dpm_display_configuration_changed,
		.fini = &sumo_dpm_fini,
		.get_sclk = &sumo_dpm_get_sclk,
		.get_mclk = &sumo_dpm_get_mclk,
		.print_power_state = &sumo_dpm_print_power_state,
1453
		.debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
1454
		.force_performance_level = &sumo_dpm_force_performance_level,
1455
	},
1456 1457
	.pflip = {
		.page_flip = &evergreen_page_flip,
1458
		.page_flip_pending = &evergreen_page_flip_pending,
1459
	},
1460 1461
};

1462 1463 1464 1465 1466 1467 1468
static struct radeon_asic btc_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
	.asic_reset = &evergreen_asic_reset,
	.vga_set_state = &r600_vga_set_state,
1469
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1470 1471
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1472
	.get_xclk = &rv770_get_xclk,
1473
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1474 1475 1476 1477
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1478
	.ring = {
1479 1480 1481
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1482
	},
1483 1484 1485 1486
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1487 1488 1489 1490
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1491
		.set_backlight_level = &atombios_set_backlight_level,
1492
		.get_backlight_level = &atombios_get_backlight_level,
1493 1494
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1495
	},
1496
	.copy = {
1497
		.blit = &r600_copy_cpdma,
1498
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1499 1500
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1501 1502
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1503
	},
1504 1505 1506 1507
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1508 1509 1510 1511 1512 1513
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1514 1515 1516 1517
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1518
		.init_profile = &btc_pm_init_profile,
1519
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1520 1521 1522 1523
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
1524 1525
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1526
		.set_clock_gating = NULL,
1527
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1528
		.get_temperature = &evergreen_get_temp,
1529
	},
1530 1531 1532 1533
	.dpm = {
		.init = &btc_dpm_init,
		.setup_asic = &btc_dpm_setup_asic,
		.enable = &btc_dpm_enable,
1534
		.late_enable = &rv770_dpm_late_enable,
1535
		.disable = &btc_dpm_disable,
1536
		.pre_set_power_state = &btc_dpm_pre_set_power_state,
1537
		.set_power_state = &btc_dpm_set_power_state,
1538
		.post_set_power_state = &btc_dpm_post_set_power_state,
1539 1540
		.display_configuration_changed = &cypress_dpm_display_configuration_changed,
		.fini = &btc_dpm_fini,
1541 1542
		.get_sclk = &btc_dpm_get_sclk,
		.get_mclk = &btc_dpm_get_mclk,
1543
		.print_power_state = &rv770_dpm_print_power_state,
1544
		.debugfs_print_current_performance_level = &btc_dpm_debugfs_print_current_performance_level,
1545
		.force_performance_level = &rv770_dpm_force_performance_level,
1546
		.vblank_too_short = &btc_dpm_vblank_too_short,
1547
	},
1548 1549
	.pflip = {
		.page_flip = &evergreen_page_flip,
1550
		.page_flip_pending = &evergreen_page_flip_pending,
1551
	},
1552 1553
};

1554 1555 1556 1557 1558 1559 1560 1561 1562 1563
static struct radeon_asic_ring cayman_gfx_ring = {
	.ib_execute = &cayman_ring_ib_execute,
	.ib_parse = &evergreen_ib_parse,
	.emit_fence = &cayman_fence_ring_emit,
	.emit_semaphore = &r600_semaphore_ring_emit,
	.cs_parse = &evergreen_cs_parse,
	.ring_test = &r600_ring_test,
	.ib_test = &r600_ib_test,
	.is_lockup = &cayman_gfx_is_lockup,
	.vm_flush = &cayman_vm_flush,
1564 1565 1566
	.get_rptr = &cayman_gfx_get_rptr,
	.get_wptr = &cayman_gfx_get_wptr,
	.set_wptr = &cayman_gfx_set_wptr,
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578
};

static struct radeon_asic_ring cayman_dma_ring = {
	.ib_execute = &cayman_dma_ring_ib_execute,
	.ib_parse = &evergreen_dma_ib_parse,
	.emit_fence = &evergreen_dma_fence_ring_emit,
	.emit_semaphore = &r600_dma_semaphore_ring_emit,
	.cs_parse = &evergreen_dma_cs_parse,
	.ring_test = &r600_dma_ring_test,
	.ib_test = &r600_dma_ib_test,
	.is_lockup = &cayman_dma_is_lockup,
	.vm_flush = &cayman_dma_vm_flush,
1579 1580 1581
	.get_rptr = &cayman_dma_get_rptr,
	.get_wptr = &cayman_dma_get_wptr,
	.set_wptr = &cayman_dma_set_wptr
1582 1583 1584
};

static struct radeon_asic_ring cayman_uvd_ring = {
1585 1586 1587
	.ib_execute = &uvd_v1_0_ib_execute,
	.emit_fence = &uvd_v2_2_fence_emit,
	.emit_semaphore = &uvd_v3_1_semaphore_emit,
1588
	.cs_parse = &radeon_uvd_cs_parse,
1589 1590
	.ring_test = &uvd_v1_0_ring_test,
	.ib_test = &uvd_v1_0_ib_test,
1591
	.is_lockup = &radeon_ring_test_lockup,
1592 1593 1594
	.get_rptr = &uvd_v1_0_get_rptr,
	.get_wptr = &uvd_v1_0_get_wptr,
	.set_wptr = &uvd_v1_0_set_wptr,
1595 1596
};

1597 1598 1599 1600 1601 1602 1603
static struct radeon_asic cayman_asic = {
	.init = &cayman_init,
	.fini = &cayman_fini,
	.suspend = &cayman_suspend,
	.resume = &cayman_resume,
	.asic_reset = &cayman_asic_reset,
	.vga_set_state = &r600_vga_set_state,
1604
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1605 1606
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1607
	.get_xclk = &rv770_get_xclk,
1608
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1609 1610 1611 1612
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1613 1614 1615
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1616 1617 1618 1619
		.copy_pages = &cayman_dma_vm_copy_pages,
		.write_pages = &cayman_dma_vm_write_pages,
		.set_pages = &cayman_dma_vm_set_pages,
		.pad_ib = &cayman_dma_vm_pad_ib,
1620
	},
1621
	.ring = {
1622 1623 1624 1625 1626 1627
		[RADEON_RING_TYPE_GFX_INDEX] = &cayman_gfx_ring,
		[CAYMAN_RING_TYPE_CP1_INDEX] = &cayman_gfx_ring,
		[CAYMAN_RING_TYPE_CP2_INDEX] = &cayman_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &cayman_dma_ring,
		[CAYMAN_RING_TYPE_DMA1_INDEX] = &cayman_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
1628
	},
1629 1630 1631 1632
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1633 1634 1635 1636
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1637
		.set_backlight_level = &atombios_set_backlight_level,
1638
		.get_backlight_level = &atombios_get_backlight_level,
1639 1640
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1641
	},
1642
	.copy = {
1643
		.blit = &r600_copy_cpdma,
1644
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1645 1646
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1647 1648
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1649
	},
1650 1651 1652 1653
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1654 1655 1656 1657 1658 1659
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1660 1661 1662 1663
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1664
		.init_profile = &btc_pm_init_profile,
1665
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1666 1667 1668 1669
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
1670 1671
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1672
		.set_clock_gating = NULL,
1673
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1674
		.get_temperature = &evergreen_get_temp,
1675
	},
1676 1677 1678 1679
	.dpm = {
		.init = &ni_dpm_init,
		.setup_asic = &ni_dpm_setup_asic,
		.enable = &ni_dpm_enable,
1680
		.late_enable = &rv770_dpm_late_enable,
1681
		.disable = &ni_dpm_disable,
1682
		.pre_set_power_state = &ni_dpm_pre_set_power_state,
1683
		.set_power_state = &ni_dpm_set_power_state,
1684
		.post_set_power_state = &ni_dpm_post_set_power_state,
1685 1686 1687 1688 1689
		.display_configuration_changed = &cypress_dpm_display_configuration_changed,
		.fini = &ni_dpm_fini,
		.get_sclk = &ni_dpm_get_sclk,
		.get_mclk = &ni_dpm_get_mclk,
		.print_power_state = &ni_dpm_print_power_state,
1690
		.debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level,
1691
		.force_performance_level = &ni_dpm_force_performance_level,
1692
		.vblank_too_short = &ni_dpm_vblank_too_short,
1693
	},
1694 1695
	.pflip = {
		.page_flip = &evergreen_page_flip,
1696
		.page_flip_pending = &evergreen_page_flip_pending,
1697
	},
1698 1699
};

1700 1701 1702 1703 1704 1705 1706
static struct radeon_asic trinity_asic = {
	.init = &cayman_init,
	.fini = &cayman_fini,
	.suspend = &cayman_suspend,
	.resume = &cayman_resume,
	.asic_reset = &cayman_asic_reset,
	.vga_set_state = &r600_vga_set_state,
1707
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1708 1709
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1710
	.get_xclk = &r600_get_xclk,
1711
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1712 1713 1714 1715
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1716 1717 1718
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1719 1720 1721 1722
		.copy_pages = &cayman_dma_vm_copy_pages,
		.write_pages = &cayman_dma_vm_write_pages,
		.set_pages = &cayman_dma_vm_set_pages,
		.pad_ib = &cayman_dma_vm_pad_ib,
1723
	},
1724
	.ring = {
1725 1726 1727 1728 1729 1730
		[RADEON_RING_TYPE_GFX_INDEX] = &cayman_gfx_ring,
		[CAYMAN_RING_TYPE_CP1_INDEX] = &cayman_gfx_ring,
		[CAYMAN_RING_TYPE_CP2_INDEX] = &cayman_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &cayman_dma_ring,
		[CAYMAN_RING_TYPE_DMA1_INDEX] = &cayman_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
1731 1732 1733 1734 1735 1736 1737 1738 1739
	},
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
	.display = {
		.bandwidth_update = &dce6_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1740
		.set_backlight_level = &atombios_set_backlight_level,
1741
		.get_backlight_level = &atombios_get_backlight_level,
1742 1743
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1744 1745
	},
	.copy = {
1746
		.blit = &r600_copy_cpdma,
1747
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1748 1749
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1750 1751
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775
	},
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &sumo_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = NULL,
		.set_memory_clock = NULL,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = NULL,
1776
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1777
		.get_temperature = &tn_get_temp,
1778
	},
1779 1780 1781 1782
	.dpm = {
		.init = &trinity_dpm_init,
		.setup_asic = &trinity_dpm_setup_asic,
		.enable = &trinity_dpm_enable,
1783
		.late_enable = &trinity_dpm_late_enable,
1784
		.disable = &trinity_dpm_disable,
1785
		.pre_set_power_state = &trinity_dpm_pre_set_power_state,
1786
		.set_power_state = &trinity_dpm_set_power_state,
1787
		.post_set_power_state = &trinity_dpm_post_set_power_state,
1788 1789 1790 1791 1792
		.display_configuration_changed = &trinity_dpm_display_configuration_changed,
		.fini = &trinity_dpm_fini,
		.get_sclk = &trinity_dpm_get_sclk,
		.get_mclk = &trinity_dpm_get_mclk,
		.print_power_state = &trinity_dpm_print_power_state,
1793
		.debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level,
1794
		.force_performance_level = &trinity_dpm_force_performance_level,
1795
		.enable_bapm = &trinity_dpm_enable_bapm,
1796
	},
1797 1798
	.pflip = {
		.page_flip = &evergreen_page_flip,
1799
		.page_flip_pending = &evergreen_page_flip_pending,
1800 1801 1802
	},
};

1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
static struct radeon_asic_ring si_gfx_ring = {
	.ib_execute = &si_ring_ib_execute,
	.ib_parse = &si_ib_parse,
	.emit_fence = &si_fence_ring_emit,
	.emit_semaphore = &r600_semaphore_ring_emit,
	.cs_parse = NULL,
	.ring_test = &r600_ring_test,
	.ib_test = &r600_ib_test,
	.is_lockup = &si_gfx_is_lockup,
	.vm_flush = &si_vm_flush,
1813 1814 1815
	.get_rptr = &cayman_gfx_get_rptr,
	.get_wptr = &cayman_gfx_get_wptr,
	.set_wptr = &cayman_gfx_set_wptr,
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827
};

static struct radeon_asic_ring si_dma_ring = {
	.ib_execute = &cayman_dma_ring_ib_execute,
	.ib_parse = &evergreen_dma_ib_parse,
	.emit_fence = &evergreen_dma_fence_ring_emit,
	.emit_semaphore = &r600_dma_semaphore_ring_emit,
	.cs_parse = NULL,
	.ring_test = &r600_dma_ring_test,
	.ib_test = &r600_dma_ib_test,
	.is_lockup = &si_dma_is_lockup,
	.vm_flush = &si_dma_vm_flush,
1828 1829 1830
	.get_rptr = &cayman_dma_get_rptr,
	.get_wptr = &cayman_dma_get_wptr,
	.set_wptr = &cayman_dma_set_wptr,
1831 1832
};

1833 1834 1835 1836 1837 1838 1839
static struct radeon_asic si_asic = {
	.init = &si_init,
	.fini = &si_fini,
	.suspend = &si_suspend,
	.resume = &si_resume,
	.asic_reset = &si_asic_reset,
	.vga_set_state = &r600_vga_set_state,
1840
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1841 1842
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1843
	.get_xclk = &si_get_xclk,
1844
	.get_gpu_clock_counter = &si_get_gpu_clock_counter,
1845 1846 1847 1848
	.gart = {
		.tlb_flush = &si_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1849 1850 1851
	.vm = {
		.init = &si_vm_init,
		.fini = &si_vm_fini,
1852 1853 1854 1855
		.copy_pages = &si_dma_vm_copy_pages,
		.write_pages = &si_dma_vm_write_pages,
		.set_pages = &si_dma_vm_set_pages,
		.pad_ib = &cayman_dma_vm_pad_ib,
1856
	},
1857
	.ring = {
1858 1859 1860 1861 1862 1863
		[RADEON_RING_TYPE_GFX_INDEX] = &si_gfx_ring,
		[CAYMAN_RING_TYPE_CP1_INDEX] = &si_gfx_ring,
		[CAYMAN_RING_TYPE_CP2_INDEX] = &si_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &si_dma_ring,
		[CAYMAN_RING_TYPE_DMA1_INDEX] = &si_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
1864 1865 1866 1867 1868 1869 1870 1871 1872
	},
	.irq = {
		.set = &si_irq_set,
		.process = &si_irq_process,
	},
	.display = {
		.bandwidth_update = &dce6_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1873
		.set_backlight_level = &atombios_set_backlight_level,
1874
		.get_backlight_level = &atombios_get_backlight_level,
1875 1876
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1877 1878
	},
	.copy = {
1879
		.blit = &r600_copy_cpdma,
1880
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1881 1882
		.dma = &si_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1883 1884
		.copy = &si_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905
	},
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &sumo_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
1906 1907
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1908
		.set_clock_gating = NULL,
1909
		.set_uvd_clocks = &si_set_uvd_clocks,
1910
		.get_temperature = &si_get_temp,
1911
	},
1912 1913 1914 1915
	.dpm = {
		.init = &si_dpm_init,
		.setup_asic = &si_dpm_setup_asic,
		.enable = &si_dpm_enable,
1916
		.late_enable = &si_dpm_late_enable,
1917 1918 1919 1920 1921 1922 1923 1924 1925
		.disable = &si_dpm_disable,
		.pre_set_power_state = &si_dpm_pre_set_power_state,
		.set_power_state = &si_dpm_set_power_state,
		.post_set_power_state = &si_dpm_post_set_power_state,
		.display_configuration_changed = &si_dpm_display_configuration_changed,
		.fini = &si_dpm_fini,
		.get_sclk = &ni_dpm_get_sclk,
		.get_mclk = &ni_dpm_get_mclk,
		.print_power_state = &ni_dpm_print_power_state,
1926
		.debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
1927
		.force_performance_level = &si_dpm_force_performance_level,
1928
		.vblank_too_short = &ni_dpm_vblank_too_short,
1929
	},
1930 1931
	.pflip = {
		.page_flip = &evergreen_page_flip,
1932
		.page_flip_pending = &evergreen_page_flip_pending,
1933 1934 1935
	},
};

1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
static struct radeon_asic_ring ci_gfx_ring = {
	.ib_execute = &cik_ring_ib_execute,
	.ib_parse = &cik_ib_parse,
	.emit_fence = &cik_fence_gfx_ring_emit,
	.emit_semaphore = &cik_semaphore_ring_emit,
	.cs_parse = NULL,
	.ring_test = &cik_ring_test,
	.ib_test = &cik_ib_test,
	.is_lockup = &cik_gfx_is_lockup,
	.vm_flush = &cik_vm_flush,
1946 1947 1948
	.get_rptr = &cik_gfx_get_rptr,
	.get_wptr = &cik_gfx_get_wptr,
	.set_wptr = &cik_gfx_set_wptr,
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
};

static struct radeon_asic_ring ci_cp_ring = {
	.ib_execute = &cik_ring_ib_execute,
	.ib_parse = &cik_ib_parse,
	.emit_fence = &cik_fence_compute_ring_emit,
	.emit_semaphore = &cik_semaphore_ring_emit,
	.cs_parse = NULL,
	.ring_test = &cik_ring_test,
	.ib_test = &cik_ib_test,
	.is_lockup = &cik_gfx_is_lockup,
	.vm_flush = &cik_vm_flush,
1961 1962 1963
	.get_rptr = &cik_compute_get_rptr,
	.get_wptr = &cik_compute_get_wptr,
	.set_wptr = &cik_compute_set_wptr,
1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
};

static struct radeon_asic_ring ci_dma_ring = {
	.ib_execute = &cik_sdma_ring_ib_execute,
	.ib_parse = &cik_ib_parse,
	.emit_fence = &cik_sdma_fence_ring_emit,
	.emit_semaphore = &cik_sdma_semaphore_ring_emit,
	.cs_parse = NULL,
	.ring_test = &cik_sdma_ring_test,
	.ib_test = &cik_sdma_ib_test,
	.is_lockup = &cik_sdma_is_lockup,
	.vm_flush = &cik_dma_vm_flush,
1976 1977 1978
	.get_rptr = &cik_sdma_get_rptr,
	.get_wptr = &cik_sdma_get_wptr,
	.set_wptr = &cik_sdma_set_wptr,
1979 1980
};

1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993
static struct radeon_asic_ring ci_vce_ring = {
	.ib_execute = &radeon_vce_ib_execute,
	.emit_fence = &radeon_vce_fence_emit,
	.emit_semaphore = &radeon_vce_semaphore_emit,
	.cs_parse = &radeon_vce_cs_parse,
	.ring_test = &radeon_vce_ring_test,
	.ib_test = &radeon_vce_ib_test,
	.is_lockup = &radeon_ring_test_lockup,
	.get_rptr = &vce_v1_0_get_rptr,
	.get_wptr = &vce_v1_0_get_wptr,
	.set_wptr = &vce_v1_0_set_wptr,
};

1994 1995 1996 1997 1998 1999 2000
static struct radeon_asic ci_asic = {
	.init = &cik_init,
	.fini = &cik_fini,
	.suspend = &cik_suspend,
	.resume = &cik_resume,
	.asic_reset = &cik_asic_reset,
	.vga_set_state = &r600_vga_set_state,
2001
	.mmio_hdp_flush = &r600_mmio_hdp_flush,
2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
	.get_xclk = &cik_get_xclk,
	.get_gpu_clock_counter = &cik_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
2013 2014 2015 2016
		.copy_pages = &cik_sdma_vm_copy_pages,
		.write_pages = &cik_sdma_vm_write_pages,
		.set_pages = &cik_sdma_vm_set_pages,
		.pad_ib = &cik_sdma_vm_pad_ib,
2017 2018
	},
	.ring = {
2019 2020 2021 2022 2023 2024
		[RADEON_RING_TYPE_GFX_INDEX] = &ci_gfx_ring,
		[CAYMAN_RING_TYPE_CP1_INDEX] = &ci_cp_ring,
		[CAYMAN_RING_TYPE_CP2_INDEX] = &ci_cp_ring,
		[R600_RING_TYPE_DMA_INDEX] = &ci_dma_ring,
		[CAYMAN_RING_TYPE_DMA1_INDEX] = &ci_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
2025 2026
		[TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
2027 2028 2029 2030 2031 2032 2033 2034 2035
	},
	.irq = {
		.set = &cik_irq_set,
		.process = &cik_irq_process,
	},
	.display = {
		.bandwidth_update = &dce8_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
2036 2037
		.set_backlight_level = &atombios_set_backlight_level,
		.get_backlight_level = &atombios_get_backlight_level,
2038 2039
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
2040 2041
	},
	.copy = {
2042
		.blit = &cik_copy_cpdma,
2043 2044 2045
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &cik_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
2046 2047
		.copy = &cik_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072
	},
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &sumo_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = NULL,
		.set_uvd_clocks = &cik_set_uvd_clocks,
2073
		.set_vce_clocks = &cik_set_vce_clocks,
2074
		.get_temperature = &ci_get_temp,
2075
	},
2076 2077 2078 2079
	.dpm = {
		.init = &ci_dpm_init,
		.setup_asic = &ci_dpm_setup_asic,
		.enable = &ci_dpm_enable,
2080
		.late_enable = &ci_dpm_late_enable,
2081 2082 2083 2084 2085 2086 2087 2088 2089
		.disable = &ci_dpm_disable,
		.pre_set_power_state = &ci_dpm_pre_set_power_state,
		.set_power_state = &ci_dpm_set_power_state,
		.post_set_power_state = &ci_dpm_post_set_power_state,
		.display_configuration_changed = &ci_dpm_display_configuration_changed,
		.fini = &ci_dpm_fini,
		.get_sclk = &ci_dpm_get_sclk,
		.get_mclk = &ci_dpm_get_mclk,
		.print_power_state = &ci_dpm_print_power_state,
2090
		.debugfs_print_current_performance_level = &ci_dpm_debugfs_print_current_performance_level,
2091
		.force_performance_level = &ci_dpm_force_performance_level,
2092
		.vblank_too_short = &ci_dpm_vblank_too_short,
2093
		.powergate_uvd = &ci_dpm_powergate_uvd,
2094
	},
2095 2096
	.pflip = {
		.page_flip = &evergreen_page_flip,
2097
		.page_flip_pending = &evergreen_page_flip_pending,
2098 2099 2100 2101 2102 2103 2104 2105 2106 2107
	},
};

static struct radeon_asic kv_asic = {
	.init = &cik_init,
	.fini = &cik_fini,
	.suspend = &cik_suspend,
	.resume = &cik_resume,
	.asic_reset = &cik_asic_reset,
	.vga_set_state = &r600_vga_set_state,
2108
	.mmio_hdp_flush = &r600_mmio_hdp_flush,
2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
	.get_xclk = &cik_get_xclk,
	.get_gpu_clock_counter = &cik_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
2120 2121 2122 2123
		.copy_pages = &cik_sdma_vm_copy_pages,
		.write_pages = &cik_sdma_vm_write_pages,
		.set_pages = &cik_sdma_vm_set_pages,
		.pad_ib = &cik_sdma_vm_pad_ib,
2124 2125
	},
	.ring = {
2126 2127 2128 2129 2130 2131
		[RADEON_RING_TYPE_GFX_INDEX] = &ci_gfx_ring,
		[CAYMAN_RING_TYPE_CP1_INDEX] = &ci_cp_ring,
		[CAYMAN_RING_TYPE_CP2_INDEX] = &ci_cp_ring,
		[R600_RING_TYPE_DMA_INDEX] = &ci_dma_ring,
		[CAYMAN_RING_TYPE_DMA1_INDEX] = &ci_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &cayman_uvd_ring,
2132 2133
		[TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
2134 2135 2136 2137 2138 2139 2140 2141 2142
	},
	.irq = {
		.set = &cik_irq_set,
		.process = &cik_irq_process,
	},
	.display = {
		.bandwidth_update = &dce8_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
2143 2144
		.set_backlight_level = &atombios_set_backlight_level,
		.get_backlight_level = &atombios_get_backlight_level,
2145 2146
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
2147 2148
	},
	.copy = {
2149
		.blit = &cik_copy_cpdma,
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &cik_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
		.copy = &cik_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
	},
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
		.init_profile = &sumo_pm_init_profile,
		.get_dynpm_state = &r600_pm_get_dynpm_state,
		.get_engine_clock = &radeon_atom_get_engine_clock,
		.set_engine_clock = &radeon_atom_set_engine_clock,
		.get_memory_clock = &radeon_atom_get_memory_clock,
		.set_memory_clock = &radeon_atom_set_memory_clock,
		.get_pcie_lanes = NULL,
		.set_pcie_lanes = NULL,
		.set_clock_gating = NULL,
		.set_uvd_clocks = &cik_set_uvd_clocks,
2180
		.set_vce_clocks = &cik_set_vce_clocks,
2181
		.get_temperature = &kv_get_temp,
2182
	},
2183 2184 2185 2186
	.dpm = {
		.init = &kv_dpm_init,
		.setup_asic = &kv_dpm_setup_asic,
		.enable = &kv_dpm_enable,
2187
		.late_enable = &kv_dpm_late_enable,
2188 2189 2190 2191 2192 2193 2194 2195 2196
		.disable = &kv_dpm_disable,
		.pre_set_power_state = &kv_dpm_pre_set_power_state,
		.set_power_state = &kv_dpm_set_power_state,
		.post_set_power_state = &kv_dpm_post_set_power_state,
		.display_configuration_changed = &kv_dpm_display_configuration_changed,
		.fini = &kv_dpm_fini,
		.get_sclk = &kv_dpm_get_sclk,
		.get_mclk = &kv_dpm_get_mclk,
		.print_power_state = &kv_dpm_print_power_state,
2197
		.debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level,
2198
		.force_performance_level = &kv_dpm_force_performance_level,
2199
		.powergate_uvd = &kv_dpm_powergate_uvd,
2200
		.enable_bapm = &kv_dpm_enable_bapm,
2201
	},
2202 2203
	.pflip = {
		.page_flip = &evergreen_page_flip,
2204
		.page_flip_pending = &evergreen_page_flip_pending,
2205 2206 2207
	},
};

2208 2209 2210 2211 2212 2213 2214 2215 2216 2217
/**
 * radeon_asic_init - register asic specific callbacks
 *
 * @rdev: radeon device pointer
 *
 * Registers the appropriate asic specific callbacks for each
 * chip family.  Also sets other asics specific info like the number
 * of crtcs and the register aperture accessors (all asics).
 * Returns 0 for success.
 */
D
Daniel Vetter 已提交
2218 2219 2220
int radeon_asic_init(struct radeon_device *rdev)
{
	radeon_register_accessor_init(rdev);
2221 2222 2223 2224 2225 2226 2227

	/* set the number of crtcs */
	if (rdev->flags & RADEON_SINGLE_CRTC)
		rdev->num_crtc = 1;
	else
		rdev->num_crtc = 2;

2228 2229
	rdev->has_uvd = false;

D
Daniel Vetter 已提交
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256
	switch (rdev->family) {
	case CHIP_R100:
	case CHIP_RV100:
	case CHIP_RS100:
	case CHIP_RV200:
	case CHIP_RS200:
		rdev->asic = &r100_asic;
		break;
	case CHIP_R200:
	case CHIP_RV250:
	case CHIP_RS300:
	case CHIP_RV280:
		rdev->asic = &r200_asic;
		break;
	case CHIP_R300:
	case CHIP_R350:
	case CHIP_RV350:
	case CHIP_RV380:
		if (rdev->flags & RADEON_IS_PCIE)
			rdev->asic = &r300_asic_pcie;
		else
			rdev->asic = &r300_asic;
		break;
	case CHIP_R420:
	case CHIP_R423:
	case CHIP_RV410:
		rdev->asic = &r420_asic;
2257 2258
		/* handle macs */
		if (rdev->bios == NULL) {
2259 2260 2261 2262
			rdev->asic->pm.get_engine_clock = &radeon_legacy_get_engine_clock;
			rdev->asic->pm.set_engine_clock = &radeon_legacy_set_engine_clock;
			rdev->asic->pm.get_memory_clock = &radeon_legacy_get_memory_clock;
			rdev->asic->pm.set_memory_clock = NULL;
2263
			rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level;
2264
		}
D
Daniel Vetter 已提交
2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287
		break;
	case CHIP_RS400:
	case CHIP_RS480:
		rdev->asic = &rs400_asic;
		break;
	case CHIP_RS600:
		rdev->asic = &rs600_asic;
		break;
	case CHIP_RS690:
	case CHIP_RS740:
		rdev->asic = &rs690_asic;
		break;
	case CHIP_RV515:
		rdev->asic = &rv515_asic;
		break;
	case CHIP_R520:
	case CHIP_RV530:
	case CHIP_RV560:
	case CHIP_RV570:
	case CHIP_R580:
		rdev->asic = &r520_asic;
		break;
	case CHIP_R600:
2288 2289
		rdev->asic = &r600_asic;
		break;
D
Daniel Vetter 已提交
2290 2291 2292 2293 2294
	case CHIP_RV610:
	case CHIP_RV630:
	case CHIP_RV620:
	case CHIP_RV635:
	case CHIP_RV670:
2295 2296
		rdev->asic = &rv6xx_asic;
		rdev->has_uvd = true;
2297
		break;
D
Daniel Vetter 已提交
2298 2299
	case CHIP_RS780:
	case CHIP_RS880:
2300
		rdev->asic = &rs780_asic;
2301
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2302 2303 2304 2305 2306 2307
		break;
	case CHIP_RV770:
	case CHIP_RV730:
	case CHIP_RV710:
	case CHIP_RV740:
		rdev->asic = &rv770_asic;
2308
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2309 2310 2311 2312 2313 2314
		break;
	case CHIP_CEDAR:
	case CHIP_REDWOOD:
	case CHIP_JUNIPER:
	case CHIP_CYPRESS:
	case CHIP_HEMLOCK:
2315 2316 2317 2318 2319
		/* set num crtcs */
		if (rdev->family == CHIP_CEDAR)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
D
Daniel Vetter 已提交
2320
		rdev->asic = &evergreen_asic;
2321
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2322
		break;
2323
	case CHIP_PALM:
2324 2325
	case CHIP_SUMO:
	case CHIP_SUMO2:
2326
		rdev->asic = &sumo_asic;
2327
		rdev->has_uvd = true;
2328
		break;
2329 2330 2331
	case CHIP_BARTS:
	case CHIP_TURKS:
	case CHIP_CAICOS:
2332 2333 2334 2335 2336
		/* set num crtcs */
		if (rdev->family == CHIP_CAICOS)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
2337
		rdev->asic = &btc_asic;
2338
		rdev->has_uvd = true;
2339
		break;
2340 2341
	case CHIP_CAYMAN:
		rdev->asic = &cayman_asic;
2342 2343
		/* set num crtcs */
		rdev->num_crtc = 6;
2344
		rdev->has_uvd = true;
2345
		break;
2346 2347 2348 2349
	case CHIP_ARUBA:
		rdev->asic = &trinity_asic;
		/* set num crtcs */
		rdev->num_crtc = 4;
2350
		rdev->has_uvd = true;
2351
		break;
2352 2353 2354
	case CHIP_TAHITI:
	case CHIP_PITCAIRN:
	case CHIP_VERDE:
2355
	case CHIP_OLAND:
2356
	case CHIP_HAINAN:
2357 2358
		rdev->asic = &si_asic;
		/* set num crtcs */
2359 2360 2361
		if (rdev->family == CHIP_HAINAN)
			rdev->num_crtc = 0;
		else if (rdev->family == CHIP_OLAND)
2362 2363 2364
			rdev->num_crtc = 2;
		else
			rdev->num_crtc = 6;
2365 2366 2367 2368
		if (rdev->family == CHIP_HAINAN)
			rdev->has_uvd = false;
		else
			rdev->has_uvd = true;
2369 2370 2371
		switch (rdev->family) {
		case CHIP_TAHITI:
			rdev->cg_flags =
A
Alex Deucher 已提交
2372
				RADEON_CG_SUPPORT_GFX_MGCG |
2373
				RADEON_CG_SUPPORT_GFX_MGLS |
2374
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
			break;
		case CHIP_PITCAIRN:
			rdev->cg_flags =
A
Alex Deucher 已提交
2389
				RADEON_CG_SUPPORT_GFX_MGCG |
2390
				RADEON_CG_SUPPORT_GFX_MGLS |
2391
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_GFX_RLC_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
			break;
		case CHIP_VERDE:
			rdev->cg_flags =
A
Alex Deucher 已提交
2408
				RADEON_CG_SUPPORT_GFX_MGCG |
2409
				RADEON_CG_SUPPORT_GFX_MGLS |
2410
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_GFX_RLC_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
2423
			rdev->pg_flags = 0 |
A
Alex Deucher 已提交
2424
				/*RADEON_PG_SUPPORT_GFX_PG | */
2425
				RADEON_PG_SUPPORT_SDMA;
2426 2427 2428
			break;
		case CHIP_OLAND:
			rdev->cg_flags =
A
Alex Deucher 已提交
2429
				RADEON_CG_SUPPORT_GFX_MGCG |
2430
				RADEON_CG_SUPPORT_GFX_MGLS |
2431
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_GFX_RLC_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
			break;
		case CHIP_HAINAN:
			rdev->cg_flags =
A
Alex Deucher 已提交
2447
				RADEON_CG_SUPPORT_GFX_MGCG |
2448
				RADEON_CG_SUPPORT_GFX_MGLS |
2449
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_GFX_RLC_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
			break;
		default:
			rdev->cg_flags = 0;
			rdev->pg_flags = 0;
			break;
		}
2467
		break;
2468
	case CHIP_BONAIRE:
2469
	case CHIP_HAWAII:
2470 2471
		rdev->asic = &ci_asic;
		rdev->num_crtc = 6;
2472
		rdev->has_uvd = true;
2473 2474 2475 2476
		if (rdev->family == CHIP_BONAIRE) {
			rdev->cg_flags =
				RADEON_CG_SUPPORT_GFX_MGCG |
				RADEON_CG_SUPPORT_GFX_MGLS |
2477
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CGTS_LS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_SDMA_LS |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
		} else {
			rdev->cg_flags =
				RADEON_CG_SUPPORT_GFX_MGCG |
				RADEON_CG_SUPPORT_GFX_MGLS |
2496
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_MC_LS |
				RADEON_CG_SUPPORT_MC_MGCG |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_SDMA_LS |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
		}
2511 2512 2513
		break;
	case CHIP_KAVERI:
	case CHIP_KABINI:
S
Samuel Li 已提交
2514
	case CHIP_MULLINS:
2515 2516
		rdev->asic = &kv_asic;
		/* set num crtcs */
2517
		if (rdev->family == CHIP_KAVERI) {
2518
			rdev->num_crtc = 4;
2519
			rdev->cg_flags =
A
Alex Deucher 已提交
2520
				RADEON_CG_SUPPORT_GFX_MGCG |
2521
				RADEON_CG_SUPPORT_GFX_MGLS |
2522
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CGTS_LS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_SDMA_LS |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
A
Alex Deucher 已提交
2535
				/*RADEON_PG_SUPPORT_GFX_PG |
2536 2537 2538 2539 2540 2541 2542 2543 2544 2545
				RADEON_PG_SUPPORT_GFX_SMG |
				RADEON_PG_SUPPORT_GFX_DMG |
				RADEON_PG_SUPPORT_UVD |
				RADEON_PG_SUPPORT_VCE |
				RADEON_PG_SUPPORT_CP |
				RADEON_PG_SUPPORT_GDS |
				RADEON_PG_SUPPORT_RLC_SMU_HS |
				RADEON_PG_SUPPORT_ACP |
				RADEON_PG_SUPPORT_SAMU;*/
		} else {
2546
			rdev->num_crtc = 2;
2547
			rdev->cg_flags =
A
Alex Deucher 已提交
2548
				RADEON_CG_SUPPORT_GFX_MGCG |
2549
				RADEON_CG_SUPPORT_GFX_MGLS |
2550
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562
				RADEON_CG_SUPPORT_GFX_CGLS |
				RADEON_CG_SUPPORT_GFX_CGTS |
				RADEON_CG_SUPPORT_GFX_CGTS_LS |
				RADEON_CG_SUPPORT_GFX_CP_LS |
				RADEON_CG_SUPPORT_SDMA_MGCG |
				RADEON_CG_SUPPORT_SDMA_LS |
				RADEON_CG_SUPPORT_BIF_LS |
				RADEON_CG_SUPPORT_VCE_MGCG |
				RADEON_CG_SUPPORT_UVD_MGCG |
				RADEON_CG_SUPPORT_HDP_LS |
				RADEON_CG_SUPPORT_HDP_MGCG;
			rdev->pg_flags = 0;
A
Alex Deucher 已提交
2563
				/*RADEON_PG_SUPPORT_GFX_PG |
2564 2565 2566 2567 2568 2569 2570 2571
				RADEON_PG_SUPPORT_GFX_SMG |
				RADEON_PG_SUPPORT_UVD |
				RADEON_PG_SUPPORT_VCE |
				RADEON_PG_SUPPORT_CP |
				RADEON_PG_SUPPORT_GDS |
				RADEON_PG_SUPPORT_RLC_SMU_HS |
				RADEON_PG_SUPPORT_SAMU;*/
		}
2572
		rdev->has_uvd = true;
2573
		break;
D
Daniel Vetter 已提交
2574 2575 2576 2577 2578 2579
	default:
		/* FIXME: not supported yet */
		return -EINVAL;
	}

	if (rdev->flags & RADEON_IS_IGP) {
2580 2581
		rdev->asic->pm.get_memory_clock = NULL;
		rdev->asic->pm.set_memory_clock = NULL;
D
Daniel Vetter 已提交
2582 2583 2584 2585 2586
	}

	return 0;
}