radeon_asic.c 82.3 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
/*
 * 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>
30
#include <linux/pci.h>
31 32
#include <linux/vgaarb.h>

D
Daniel Vetter 已提交
33 34
#include <drm/drm_crtc_helper.h>
#include <drm/radeon_drm.h>
35 36

#include "atom.h"
D
Daniel Vetter 已提交
37 38
#include "radeon.h"
#include "radeon_asic.h"
39
#include "radeon_reg.h"
D
Daniel Vetter 已提交
40 41 42 43

/*
 * Registers accessors functions.
 */
44 45 46 47 48 49 50 51 52 53
/**
 * 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 已提交
54 55 56 57 58 59 60
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;
}

61 62 63 64 65 66 67 68 69 70
/**
 * 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 已提交
71 72 73 74 75 76 77
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);
}

78 79 80 81 82 83 84 85
/**
 * 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 已提交
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 125
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;
	}
126 127 128 129
	if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) {
		rdev->mc_rreg = &rs780_mc_rreg;
		rdev->mc_wreg = &rs780_mc_wreg;
	}
130 131 132 133 134

	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 已提交
135 136 137 138 139
		rdev->pciep_rreg = &r600_pciep_rreg;
		rdev->pciep_wreg = &r600_pciep_wreg;
	}
}

140 141 142 143 144
static int radeon_invalid_get_allowed_info_register(struct radeon_device *rdev,
						    u32 reg, u32 *val)
{
	return -EINVAL;
}
D
Daniel Vetter 已提交
145 146

/* helper to disable agp */
147 148 149 150 151 152 153 154
/**
 * 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 已提交
155 156 157 158 159 160 161 162 163 164 165 166
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;
167
		rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
168
		rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry;
169
		rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
D
Daniel Vetter 已提交
170 171 172
	} else {
		DRM_INFO("Forcing AGP to PCI mode\n");
		rdev->flags |= RADEON_IS_PCI;
173
		rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
174
		rdev->asic->gart.get_page_entry = &r100_pci_gart_get_page_entry;
175
		rdev->asic->gart.set_page = &r100_pci_gart_set_page;
D
Daniel Vetter 已提交
176 177 178 179 180 181 182
	}
	rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
}

/*
 * ASIC
 */
183

184
static const struct radeon_asic_ring r100_gfx_ring = {
185 186 187 188 189 190 191 192
	.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,
193 194 195
	.get_rptr = &r100_gfx_get_rptr,
	.get_wptr = &r100_gfx_get_wptr,
	.set_wptr = &r100_gfx_set_wptr,
196 197
};

198 199 200 201 202 203
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,
204
	.asic_reset = &r100_asic_reset,
205
	.mmio_hdp_flush = NULL,
206 207
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
208
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
209 210
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
211
		.get_page_entry = &r100_pci_gart_get_page_entry,
212 213
		.set_page = &r100_pci_gart_set_page,
	},
214
	.ring = {
215
		[RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
216
	},
217 218 219 220
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
221 222 223 224
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
225
		.set_backlight_level = &radeon_legacy_set_backlight_level,
226
		.get_backlight_level = &radeon_legacy_get_backlight_level,
227
	},
228 229 230 231 232 233 234 235
	.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,
	},
236 237 238 239
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
240 241 242 243 244 245
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
246 247 248 249 250 251
	.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,
252 253 254 255 256 257 258
		.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,
259
	},
260 261
	.pflip = {
		.page_flip = &r100_page_flip,
262
		.page_flip_pending = &r100_page_flip_pending,
263
	},
264 265 266 267 268 269 270 271
};

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,
272
	.asic_reset = &r100_asic_reset,
273
	.mmio_hdp_flush = NULL,
274 275
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
276
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
277 278
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
279
		.get_page_entry = &r100_pci_gart_get_page_entry,
280 281
		.set_page = &r100_pci_gart_set_page,
	},
282
	.ring = {
283
		[RADEON_RING_TYPE_GFX_INDEX] = &r100_gfx_ring
284
	},
285 286 287 288
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
289 290 291 292
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
293
		.set_backlight_level = &radeon_legacy_set_backlight_level,
294
		.get_backlight_level = &radeon_legacy_get_backlight_level,
295
	},
296 297 298 299 300 301 302 303
	.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,
	},
304 305 306 307
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
308 309 310 311 312 313
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
314 315 316 317 318 319
	.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,
320 321 322 323 324 325 326
		.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,
327
	},
328 329
	.pflip = {
		.page_flip = &r100_page_flip,
330
		.page_flip_pending = &r100_page_flip_pending,
331
	},
332 333
};

334
static const struct radeon_asic_ring r300_gfx_ring = {
335 336 337 338 339 340 341 342
	.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,
343 344 345
	.get_rptr = &r100_gfx_get_rptr,
	.get_wptr = &r100_gfx_get_wptr,
	.set_wptr = &r100_gfx_set_wptr,
346 347
};

348
static const struct radeon_asic_ring rv515_gfx_ring = {
349 350 351 352 353 354 355 356 357 358 359 360 361
	.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 = &rv515_ring_start,
	.ring_test = &r100_ring_test,
	.ib_test = &r100_ib_test,
	.is_lockup = &r100_gpu_is_lockup,
	.get_rptr = &r100_gfx_get_rptr,
	.get_wptr = &r100_gfx_get_wptr,
	.set_wptr = &r100_gfx_set_wptr,
};

362 363 364 365 366 367
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,
368
	.asic_reset = &r300_asic_reset,
369
	.mmio_hdp_flush = NULL,
370 371
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
372
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
373 374
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
375
		.get_page_entry = &r100_pci_gart_get_page_entry,
376 377
		.set_page = &r100_pci_gart_set_page,
	},
378
	.ring = {
379
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
380
	},
381 382 383 384
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
385 386 387 388
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
389
		.set_backlight_level = &radeon_legacy_set_backlight_level,
390
		.get_backlight_level = &radeon_legacy_get_backlight_level,
391
	},
392 393 394 395 396 397 398 399
	.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,
	},
400 401 402 403
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
404 405 406 407 408 409
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
410 411 412 413 414 415
	.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,
416 417 418 419 420 421 422
		.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,
423
	},
424 425
	.pflip = {
		.page_flip = &r100_page_flip,
426
		.page_flip_pending = &r100_page_flip_pending,
427
	},
428 429 430 431 432 433 434 435
};

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,
436
	.asic_reset = &r300_asic_reset,
437
	.mmio_hdp_flush = NULL,
438 439
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
440
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
441 442
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
443
		.get_page_entry = &rv370_pcie_gart_get_page_entry,
444 445
		.set_page = &rv370_pcie_gart_set_page,
	},
446
	.ring = {
447
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
448
	},
449 450 451 452
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
453 454 455 456
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
457
		.set_backlight_level = &radeon_legacy_set_backlight_level,
458
		.get_backlight_level = &radeon_legacy_get_backlight_level,
459
	},
460 461 462 463 464 465 466 467
	.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,
	},
468 469 470 471
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
472 473 474 475 476 477
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
478 479 480 481 482 483
	.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,
484 485 486 487 488 489 490
		.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,
491
	},
492 493
	.pflip = {
		.page_flip = &r100_page_flip,
494
		.page_flip_pending = &r100_page_flip_pending,
495
	},
496 497 498 499 500 501 502 503
};

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,
504
	.asic_reset = &r300_asic_reset,
505
	.mmio_hdp_flush = NULL,
506 507
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
508
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
509 510
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
511
		.get_page_entry = &rv370_pcie_gart_get_page_entry,
512 513
		.set_page = &rv370_pcie_gart_set_page,
	},
514
	.ring = {
515
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
516
	},
517 518 519 520
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
521 522 523 524
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
525
		.set_backlight_level = &atombios_set_backlight_level,
526
		.get_backlight_level = &atombios_get_backlight_level,
527
	},
528 529 530 531 532 533 534 535
	.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,
	},
536 537 538 539
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
540 541 542 543 544 545
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
546 547 548 549 550 551
	.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,
552 553 554 555 556 557 558
		.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,
559
	},
560 561
	.pflip = {
		.page_flip = &r100_page_flip,
562
		.page_flip_pending = &r100_page_flip_pending,
563
	},
564 565 566 567 568 569 570 571
};

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,
572
	.asic_reset = &r300_asic_reset,
573
	.mmio_hdp_flush = NULL,
574 575
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs400_mc_wait_for_idle,
576
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
577 578
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
579
		.get_page_entry = &rs400_gart_get_page_entry,
580 581
		.set_page = &rs400_gart_set_page,
	},
582
	.ring = {
583
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
584
	},
585 586 587 588
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
589 590 591 592
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
593
		.set_backlight_level = &radeon_legacy_set_backlight_level,
594
		.get_backlight_level = &radeon_legacy_get_backlight_level,
595
	},
596 597 598 599 600 601 602 603
	.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,
	},
604 605 606 607
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
608 609 610 611 612 613
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
614 615 616 617 618 619
	.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,
620 621 622 623 624 625 626
		.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,
627
	},
628 629
	.pflip = {
		.page_flip = &r100_page_flip,
630
		.page_flip_pending = &r100_page_flip_pending,
631
	},
632 633 634 635 636 637 638 639
};

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,
640
	.asic_reset = &rs600_asic_reset,
641
	.mmio_hdp_flush = NULL,
642 643
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs600_mc_wait_for_idle,
644
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
645 646
	.gart = {
		.tlb_flush = &rs600_gart_tlb_flush,
647
		.get_page_entry = &rs600_gart_get_page_entry,
648 649
		.set_page = &rs600_gart_set_page,
	},
650
	.ring = {
651
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
652
	},
653 654 655 656
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
657 658 659 660
	.display = {
		.bandwidth_update = &rs600_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
661
		.set_backlight_level = &atombios_set_backlight_level,
662
		.get_backlight_level = &atombios_get_backlight_level,
663
	},
664 665 666 667 668 669 670 671
	.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,
	},
672 673 674 675
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
676 677 678 679 680 681
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
682 683 684 685 686 687
	.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,
688 689 690 691 692 693 694
		.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,
695
	},
696 697
	.pflip = {
		.page_flip = &rs600_page_flip,
698
		.page_flip_pending = &rs600_page_flip_pending,
699
	},
700 701 702 703 704 705 706 707
};

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,
708
	.asic_reset = &rs600_asic_reset,
709
	.mmio_hdp_flush = NULL,
710 711
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs690_mc_wait_for_idle,
712
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
713 714
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
715
		.get_page_entry = &rs400_gart_get_page_entry,
716 717
		.set_page = &rs400_gart_set_page,
	},
718
	.ring = {
719
		[RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring
720
	},
721 722 723 724
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
725 726 727 728
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rs690_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
729
		.set_backlight_level = &atombios_set_backlight_level,
730
		.get_backlight_level = &atombios_get_backlight_level,
731
	},
732 733 734 735 736 737 738 739
	.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,
	},
740 741 742 743
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
744 745 746 747 748 749
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
750 751 752 753 754 755
	.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,
756 757 758 759 760 761 762
		.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,
763
	},
764 765
	.pflip = {
		.page_flip = &rs600_page_flip,
766
		.page_flip_pending = &rs600_page_flip_pending,
767
	},
768 769 770 771 772 773 774 775
};

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,
776
	.asic_reset = &rs600_asic_reset,
777
	.mmio_hdp_flush = NULL,
778 779
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rv515_mc_wait_for_idle,
780
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
781 782
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
783
		.get_page_entry = &rv370_pcie_gart_get_page_entry,
784 785
		.set_page = &rv370_pcie_gart_set_page,
	},
786
	.ring = {
787
		[RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
788
	},
789 790 791 792
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
793 794 795 796
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rv515_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
797
		.set_backlight_level = &atombios_set_backlight_level,
798
		.get_backlight_level = &atombios_get_backlight_level,
799
	},
800 801 802 803 804 805 806 807
	.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,
	},
808 809 810 811
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
812 813 814 815 816 817
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
818 819 820 821 822 823
	.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,
824 825 826 827 828 829 830
		.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,
831
	},
832 833
	.pflip = {
		.page_flip = &rs600_page_flip,
834
		.page_flip_pending = &rs600_page_flip_pending,
835
	},
836 837 838 839 840 841 842 843
};

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,
844
	.asic_reset = &rs600_asic_reset,
845
	.mmio_hdp_flush = NULL,
846 847
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r520_mc_wait_for_idle,
848
	.get_allowed_info_register = radeon_invalid_get_allowed_info_register,
849 850
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
851
		.get_page_entry = &rv370_pcie_gart_get_page_entry,
852 853
		.set_page = &rv370_pcie_gart_set_page,
	},
854
	.ring = {
855
		[RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring
856
	},
857 858 859 860
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
861 862 863 864
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
865
		.set_backlight_level = &atombios_set_backlight_level,
866
		.get_backlight_level = &atombios_get_backlight_level,
867
	},
868 869 870 871 872 873 874 875
	.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,
	},
876 877 878 879
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
880 881 882 883 884 885
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
886 887 888 889 890 891
	.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,
892 893 894 895 896 897 898
		.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,
899
	},
900 901
	.pflip = {
		.page_flip = &rs600_page_flip,
902
		.page_flip_pending = &rs600_page_flip_pending,
903
	},
904 905
};

906
static const struct radeon_asic_ring r600_gfx_ring = {
907 908 909 910 911 912 913
	.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,
914 915 916
	.get_rptr = &r600_gfx_get_rptr,
	.get_wptr = &r600_gfx_get_wptr,
	.set_wptr = &r600_gfx_set_wptr,
917 918
};

919
static const struct radeon_asic_ring r600_dma_ring = {
920 921 922 923 924 925 926
	.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,
927 928 929
	.get_rptr = &r600_dma_get_rptr,
	.get_wptr = &r600_dma_get_wptr,
	.set_wptr = &r600_dma_set_wptr,
930 931
};

932 933 934 935 936 937
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,
938
	.asic_reset = &r600_asic_reset,
939
	.mmio_hdp_flush = r600_mmio_hdp_flush,
940 941
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
942
	.get_xclk = &r600_get_xclk,
943
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
944
	.get_allowed_info_register = r600_get_allowed_info_register,
945 946
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
947
		.get_page_entry = &rs600_gart_get_page_entry,
948 949
		.set_page = &rs600_gart_set_page,
	},
950
	.ring = {
951 952
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
953
	},
954 955 956 957
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
958 959 960 961
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
962
		.set_backlight_level = &atombios_set_backlight_level,
963
		.get_backlight_level = &atombios_get_backlight_level,
964
	},
965
	.copy = {
966
		.blit = &r600_copy_cpdma,
967
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
968 969
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
970
		.copy = &r600_copy_cpdma,
971
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
972
	},
973 974 975 976
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
977 978 979 980 981 982
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
983 984 985 986 987 988
	.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,
989 990 991 992 993 994 995
		.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,
996
		.get_temperature = &rv6xx_get_temp,
997
	},
998 999
	.pflip = {
		.page_flip = &rs600_page_flip,
1000
		.page_flip_pending = &rs600_page_flip_pending,
1001
	},
1002 1003
};

1004
static const struct radeon_asic_ring rv6xx_uvd_ring = {
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
	.ib_execute = &uvd_v1_0_ib_execute,
	.emit_fence = &uvd_v1_0_fence_emit,
	.emit_semaphore = &uvd_v1_0_semaphore_emit,
	.cs_parse = &radeon_uvd_cs_parse,
	.ring_test = &uvd_v1_0_ring_test,
	.ib_test = &uvd_v1_0_ib_test,
	.is_lockup = &radeon_ring_test_lockup,
	.get_rptr = &uvd_v1_0_get_rptr,
	.get_wptr = &uvd_v1_0_get_wptr,
	.set_wptr = &uvd_v1_0_set_wptr,
};

1017 1018 1019 1020 1021 1022 1023
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,
1024
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1025 1026 1027 1028
	.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,
1029
	.get_allowed_info_register = r600_get_allowed_info_register,
1030 1031
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
1032
		.get_page_entry = &rs600_gart_get_page_entry,
1033 1034 1035
		.set_page = &rs600_gart_set_page,
	},
	.ring = {
1036 1037
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
1038
		[R600_RING_TYPE_UVD_INDEX] = &rv6xx_uvd_ring,
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
	},
	.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,
	},
	.copy = {
1052
		.blit = &r600_copy_cpdma,
1053 1054 1055
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1056
		.copy = &r600_copy_cpdma,
1057
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
	},
	.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,
1083
		.set_uvd_clocks = &r600_set_uvd_clocks,
1084
	},
1085 1086 1087 1088
	.dpm = {
		.init = &rv6xx_dpm_init,
		.setup_asic = &rv6xx_setup_asic,
		.enable = &rv6xx_dpm_enable,
1089
		.late_enable = &r600_dpm_late_enable,
1090
		.disable = &rv6xx_dpm_disable,
1091
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1092
		.set_power_state = &rv6xx_dpm_set_power_state,
1093
		.post_set_power_state = &r600_dpm_post_set_power_state,
1094 1095 1096 1097 1098
		.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,
1099
		.debugfs_print_current_performance_level = &rv6xx_dpm_debugfs_print_current_performance_level,
1100
		.force_performance_level = &rv6xx_dpm_force_performance_level,
1101 1102
		.get_current_sclk = &rv6xx_dpm_get_current_sclk,
		.get_current_mclk = &rv6xx_dpm_get_current_mclk,
1103
	},
1104 1105
	.pflip = {
		.page_flip = &rs600_page_flip,
1106
		.page_flip_pending = &rs600_page_flip_pending,
1107 1108 1109
	},
};

1110 1111 1112 1113 1114 1115
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,
1116
	.asic_reset = &r600_asic_reset,
1117
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1118 1119
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1120
	.get_xclk = &r600_get_xclk,
1121
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1122
	.get_allowed_info_register = r600_get_allowed_info_register,
1123 1124
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
1125
		.get_page_entry = &rs600_gart_get_page_entry,
1126 1127
		.set_page = &rs600_gart_set_page,
	},
1128
	.ring = {
1129 1130
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
1131
		[R600_RING_TYPE_UVD_INDEX] = &rv6xx_uvd_ring,
1132
	},
1133 1134 1135 1136
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1137 1138 1139 1140
	.display = {
		.bandwidth_update = &rs690_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1141
		.set_backlight_level = &atombios_set_backlight_level,
1142
		.get_backlight_level = &atombios_get_backlight_level,
1143
	},
1144
	.copy = {
1145
		.blit = &r600_copy_cpdma,
1146
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1147 1148
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1149
		.copy = &r600_copy_cpdma,
1150
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1151
	},
1152 1153 1154 1155
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1156 1157 1158 1159 1160 1161
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1162 1163 1164 1165 1166 1167
	.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,
1168 1169 1170 1171 1172 1173 1174
		.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,
1175
		.get_temperature = &rv6xx_get_temp,
1176
		.set_uvd_clocks = &r600_set_uvd_clocks,
1177
	},
1178 1179 1180 1181
	.dpm = {
		.init = &rs780_dpm_init,
		.setup_asic = &rs780_dpm_setup_asic,
		.enable = &rs780_dpm_enable,
1182
		.late_enable = &r600_dpm_late_enable,
1183
		.disable = &rs780_dpm_disable,
1184
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1185
		.set_power_state = &rs780_dpm_set_power_state,
1186
		.post_set_power_state = &r600_dpm_post_set_power_state,
1187 1188 1189 1190 1191
		.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,
1192
		.debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level,
1193
		.force_performance_level = &rs780_dpm_force_performance_level,
1194 1195
		.get_current_sclk = &rs780_dpm_get_current_sclk,
		.get_current_mclk = &rs780_dpm_get_current_mclk,
1196
	},
1197 1198
	.pflip = {
		.page_flip = &rs600_page_flip,
1199
		.page_flip_pending = &rs600_page_flip_pending,
1200
	},
1201 1202
};

1203
static const struct radeon_asic_ring rv770_uvd_ring = {
1204 1205
	.ib_execute = &uvd_v1_0_ib_execute,
	.emit_fence = &uvd_v2_2_fence_emit,
1206
	.emit_semaphore = &uvd_v2_2_semaphore_emit,
1207
	.cs_parse = &radeon_uvd_cs_parse,
1208 1209
	.ring_test = &uvd_v1_0_ring_test,
	.ib_test = &uvd_v1_0_ib_test,
1210
	.is_lockup = &radeon_ring_test_lockup,
1211 1212 1213
	.get_rptr = &uvd_v1_0_get_rptr,
	.get_wptr = &uvd_v1_0_get_wptr,
	.set_wptr = &uvd_v1_0_set_wptr,
1214 1215
};

1216 1217 1218 1219 1220
static struct radeon_asic rv770_asic = {
	.init = &rv770_init,
	.fini = &rv770_fini,
	.suspend = &rv770_suspend,
	.resume = &rv770_resume,
1221
	.asic_reset = &r600_asic_reset,
1222
	.vga_set_state = &r600_vga_set_state,
1223
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1224 1225
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1226
	.get_xclk = &rv770_get_xclk,
1227
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1228
	.get_allowed_info_register = r600_get_allowed_info_register,
1229 1230
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
1231
		.get_page_entry = &rs600_gart_get_page_entry,
1232 1233
		.set_page = &rs600_gart_set_page,
	},
1234
	.ring = {
1235 1236 1237
		[RADEON_RING_TYPE_GFX_INDEX] = &r600_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &r600_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1238
	},
1239 1240 1241 1242
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1243 1244 1245 1246
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1247
		.set_backlight_level = &atombios_set_backlight_level,
1248
		.get_backlight_level = &atombios_get_backlight_level,
1249
	},
1250
	.copy = {
1251
		.blit = &r600_copy_cpdma,
1252
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1253
		.dma = &rv770_copy_dma,
1254
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1255
		.copy = &rv770_copy_dma,
1256
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1257
	},
1258 1259 1260 1261
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1262 1263 1264 1265 1266 1267
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1268 1269 1270 1271 1272 1273
	.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,
1274 1275 1276 1277 1278 1279 1280
		.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,
1281
		.set_uvd_clocks = &rv770_set_uvd_clocks,
1282
		.get_temperature = &rv770_get_temp,
1283
	},
1284 1285 1286 1287
	.dpm = {
		.init = &rv770_dpm_init,
		.setup_asic = &rv770_dpm_setup_asic,
		.enable = &rv770_dpm_enable,
1288
		.late_enable = &rv770_dpm_late_enable,
1289
		.disable = &rv770_dpm_disable,
1290
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1291
		.set_power_state = &rv770_dpm_set_power_state,
1292
		.post_set_power_state = &r600_dpm_post_set_power_state,
1293 1294 1295 1296 1297
		.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,
1298
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1299
		.force_performance_level = &rv770_dpm_force_performance_level,
1300
		.vblank_too_short = &rv770_dpm_vblank_too_short,
1301 1302
		.get_current_sclk = &rv770_dpm_get_current_sclk,
		.get_current_mclk = &rv770_dpm_get_current_mclk,
1303
	},
1304 1305
	.pflip = {
		.page_flip = &rv770_page_flip,
1306
		.page_flip_pending = &rv770_page_flip_pending,
1307
	},
1308 1309
};

1310
static const struct radeon_asic_ring evergreen_gfx_ring = {
1311 1312 1313 1314 1315 1316 1317
	.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,
1318 1319 1320
	.get_rptr = &r600_gfx_get_rptr,
	.get_wptr = &r600_gfx_get_wptr,
	.set_wptr = &r600_gfx_set_wptr,
1321 1322
};

1323
static const struct radeon_asic_ring evergreen_dma_ring = {
1324 1325 1326 1327 1328 1329 1330
	.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,
1331 1332 1333
	.get_rptr = &r600_dma_get_rptr,
	.get_wptr = &r600_dma_get_wptr,
	.set_wptr = &r600_dma_set_wptr,
1334 1335
};

1336 1337 1338 1339 1340
static struct radeon_asic evergreen_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
1341
	.asic_reset = &evergreen_asic_reset,
1342
	.vga_set_state = &r600_vga_set_state,
1343
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1344 1345
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1346
	.get_xclk = &rv770_get_xclk,
1347
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1348
	.get_allowed_info_register = evergreen_get_allowed_info_register,
1349 1350
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
1351
		.get_page_entry = &rs600_gart_get_page_entry,
1352 1353
		.set_page = &rs600_gart_set_page,
	},
1354
	.ring = {
1355 1356 1357
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1358
	},
1359 1360 1361 1362
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1363 1364 1365 1366
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1367
		.set_backlight_level = &atombios_set_backlight_level,
1368
		.get_backlight_level = &atombios_get_backlight_level,
1369
	},
1370
	.copy = {
1371
		.blit = &r600_copy_cpdma,
1372
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1373 1374
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1375 1376
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1377
	},
1378 1379 1380 1381
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1382 1383 1384 1385 1386 1387
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1388 1389 1390 1391 1392 1393
	.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,
1394 1395 1396 1397 1398 1399 1400
		.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,
1401
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1402
		.get_temperature = &evergreen_get_temp,
1403
	},
1404 1405 1406 1407
	.dpm = {
		.init = &cypress_dpm_init,
		.setup_asic = &cypress_dpm_setup_asic,
		.enable = &cypress_dpm_enable,
1408
		.late_enable = &rv770_dpm_late_enable,
1409
		.disable = &cypress_dpm_disable,
1410
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1411
		.set_power_state = &cypress_dpm_set_power_state,
1412
		.post_set_power_state = &r600_dpm_post_set_power_state,
1413 1414 1415 1416 1417
		.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,
1418
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1419
		.force_performance_level = &rv770_dpm_force_performance_level,
1420
		.vblank_too_short = &cypress_dpm_vblank_too_short,
1421 1422
		.get_current_sclk = &rv770_dpm_get_current_sclk,
		.get_current_mclk = &rv770_dpm_get_current_mclk,
1423
	},
1424 1425
	.pflip = {
		.page_flip = &evergreen_page_flip,
1426
		.page_flip_pending = &evergreen_page_flip_pending,
1427
	},
1428 1429
};

1430 1431 1432 1433 1434 1435 1436
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,
1437
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1438 1439
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1440
	.get_xclk = &r600_get_xclk,
1441
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1442
	.get_allowed_info_register = evergreen_get_allowed_info_register,
1443 1444
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
1445
		.get_page_entry = &rs600_gart_get_page_entry,
1446 1447
		.set_page = &rs600_gart_set_page,
	},
1448
	.ring = {
1449 1450 1451
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1452
	},
1453 1454 1455 1456
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1457 1458 1459 1460
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1461
		.set_backlight_level = &atombios_set_backlight_level,
1462
		.get_backlight_level = &atombios_get_backlight_level,
1463
	},
1464
	.copy = {
1465
		.blit = &r600_copy_cpdma,
1466
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1467 1468
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1469 1470
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1471
	},
1472 1473 1474 1475
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1476 1477 1478 1479 1480 1481
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1482 1483 1484 1485 1486 1487
	.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,
1488 1489 1490 1491 1492 1493 1494
		.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,
1495
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1496
		.get_temperature = &sumo_get_temp,
1497
	},
1498 1499 1500 1501
	.dpm = {
		.init = &sumo_dpm_init,
		.setup_asic = &sumo_dpm_setup_asic,
		.enable = &sumo_dpm_enable,
1502
		.late_enable = &sumo_dpm_late_enable,
1503
		.disable = &sumo_dpm_disable,
1504
		.pre_set_power_state = &sumo_dpm_pre_set_power_state,
1505
		.set_power_state = &sumo_dpm_set_power_state,
1506
		.post_set_power_state = &sumo_dpm_post_set_power_state,
1507 1508 1509 1510 1511
		.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,
1512
		.debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
1513
		.force_performance_level = &sumo_dpm_force_performance_level,
1514 1515
		.get_current_sclk = &sumo_dpm_get_current_sclk,
		.get_current_mclk = &sumo_dpm_get_current_mclk,
1516
		.get_current_vddc = &sumo_dpm_get_current_vddc,
1517
	},
1518 1519
	.pflip = {
		.page_flip = &evergreen_page_flip,
1520
		.page_flip_pending = &evergreen_page_flip_pending,
1521
	},
1522 1523
};

1524 1525 1526 1527 1528 1529 1530
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,
1531
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1532 1533
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1534
	.get_xclk = &rv770_get_xclk,
1535
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1536
	.get_allowed_info_register = evergreen_get_allowed_info_register,
1537 1538
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
1539
		.get_page_entry = &rs600_gart_get_page_entry,
1540 1541
		.set_page = &rs600_gart_set_page,
	},
1542
	.ring = {
1543 1544 1545
		[RADEON_RING_TYPE_GFX_INDEX] = &evergreen_gfx_ring,
		[R600_RING_TYPE_DMA_INDEX] = &evergreen_dma_ring,
		[R600_RING_TYPE_UVD_INDEX] = &rv770_uvd_ring,
1546
	},
1547 1548 1549 1550
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1551 1552 1553 1554
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1555
		.set_backlight_level = &atombios_set_backlight_level,
1556
		.get_backlight_level = &atombios_get_backlight_level,
1557
	},
1558
	.copy = {
1559
		.blit = &r600_copy_cpdma,
1560
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1561 1562
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1563 1564
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1565
	},
1566 1567 1568 1569
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1570 1571 1572 1573 1574 1575
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1576 1577 1578 1579
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1580
		.init_profile = &btc_pm_init_profile,
1581
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1582 1583 1584 1585
		.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,
1586 1587
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1588
		.set_clock_gating = NULL,
1589
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1590
		.get_temperature = &evergreen_get_temp,
1591
	},
1592 1593 1594 1595
	.dpm = {
		.init = &btc_dpm_init,
		.setup_asic = &btc_dpm_setup_asic,
		.enable = &btc_dpm_enable,
1596
		.late_enable = &rv770_dpm_late_enable,
1597
		.disable = &btc_dpm_disable,
1598
		.pre_set_power_state = &btc_dpm_pre_set_power_state,
1599
		.set_power_state = &btc_dpm_set_power_state,
1600
		.post_set_power_state = &btc_dpm_post_set_power_state,
1601 1602
		.display_configuration_changed = &cypress_dpm_display_configuration_changed,
		.fini = &btc_dpm_fini,
1603 1604
		.get_sclk = &btc_dpm_get_sclk,
		.get_mclk = &btc_dpm_get_mclk,
1605
		.print_power_state = &rv770_dpm_print_power_state,
1606
		.debugfs_print_current_performance_level = &btc_dpm_debugfs_print_current_performance_level,
1607
		.force_performance_level = &rv770_dpm_force_performance_level,
1608
		.vblank_too_short = &btc_dpm_vblank_too_short,
1609 1610
		.get_current_sclk = &btc_dpm_get_current_sclk,
		.get_current_mclk = &btc_dpm_get_current_mclk,
1611
	},
1612 1613
	.pflip = {
		.page_flip = &evergreen_page_flip,
1614
		.page_flip_pending = &evergreen_page_flip_pending,
1615
	},
1616 1617
};

1618
static const struct radeon_asic_ring cayman_gfx_ring = {
1619 1620 1621 1622 1623 1624 1625 1626 1627
	.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,
1628 1629 1630
	.get_rptr = &cayman_gfx_get_rptr,
	.get_wptr = &cayman_gfx_get_wptr,
	.set_wptr = &cayman_gfx_set_wptr,
1631 1632
};

1633
static const struct radeon_asic_ring cayman_dma_ring = {
1634 1635 1636 1637 1638 1639 1640 1641 1642
	.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,
1643 1644 1645
	.get_rptr = &cayman_dma_get_rptr,
	.get_wptr = &cayman_dma_get_wptr,
	.set_wptr = &cayman_dma_set_wptr
1646 1647
};

1648
static const struct radeon_asic_ring cayman_uvd_ring = {
1649 1650 1651
	.ib_execute = &uvd_v1_0_ib_execute,
	.emit_fence = &uvd_v2_2_fence_emit,
	.emit_semaphore = &uvd_v3_1_semaphore_emit,
1652
	.cs_parse = &radeon_uvd_cs_parse,
1653 1654
	.ring_test = &uvd_v1_0_ring_test,
	.ib_test = &uvd_v1_0_ib_test,
1655
	.is_lockup = &radeon_ring_test_lockup,
1656 1657 1658
	.get_rptr = &uvd_v1_0_get_rptr,
	.get_wptr = &uvd_v1_0_get_wptr,
	.set_wptr = &uvd_v1_0_set_wptr,
1659 1660
};

1661 1662 1663 1664 1665 1666 1667
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,
1668
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1669 1670
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1671
	.get_xclk = &rv770_get_xclk,
1672
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1673
	.get_allowed_info_register = cayman_get_allowed_info_register,
1674 1675
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
1676
		.get_page_entry = &rs600_gart_get_page_entry,
1677 1678
		.set_page = &rs600_gart_set_page,
	},
1679 1680 1681
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1682 1683 1684 1685
		.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,
1686
	},
1687
	.ring = {
1688 1689 1690 1691 1692 1693
		[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,
1694
	},
1695 1696 1697 1698
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1699 1700 1701 1702
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1703
		.set_backlight_level = &atombios_set_backlight_level,
1704
		.get_backlight_level = &atombios_get_backlight_level,
1705
	},
1706
	.copy = {
1707
		.blit = &r600_copy_cpdma,
1708
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1709 1710
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1711 1712
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1713
	},
1714 1715 1716 1717
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1718 1719 1720 1721 1722 1723
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1724 1725 1726 1727
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1728
		.init_profile = &btc_pm_init_profile,
1729
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1730 1731 1732 1733
		.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,
1734 1735
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1736
		.set_clock_gating = NULL,
1737
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1738
		.get_temperature = &evergreen_get_temp,
1739
	},
1740 1741 1742 1743
	.dpm = {
		.init = &ni_dpm_init,
		.setup_asic = &ni_dpm_setup_asic,
		.enable = &ni_dpm_enable,
1744
		.late_enable = &rv770_dpm_late_enable,
1745
		.disable = &ni_dpm_disable,
1746
		.pre_set_power_state = &ni_dpm_pre_set_power_state,
1747
		.set_power_state = &ni_dpm_set_power_state,
1748
		.post_set_power_state = &ni_dpm_post_set_power_state,
1749 1750 1751 1752 1753
		.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,
1754
		.debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level,
1755
		.force_performance_level = &ni_dpm_force_performance_level,
1756
		.vblank_too_short = &ni_dpm_vblank_too_short,
1757 1758
		.get_current_sclk = &ni_dpm_get_current_sclk,
		.get_current_mclk = &ni_dpm_get_current_mclk,
1759
	},
1760 1761
	.pflip = {
		.page_flip = &evergreen_page_flip,
1762
		.page_flip_pending = &evergreen_page_flip_pending,
1763
	},
1764 1765
};

1766
static const struct radeon_asic_ring trinity_vce_ring = {
1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778
	.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,
};

1779 1780 1781 1782 1783 1784 1785
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,
1786
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1787 1788
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1789
	.get_xclk = &r600_get_xclk,
1790
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1791
	.get_allowed_info_register = cayman_get_allowed_info_register,
1792 1793
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
1794
		.get_page_entry = &rs600_gart_get_page_entry,
1795 1796
		.set_page = &rs600_gart_set_page,
	},
1797 1798 1799
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1800 1801 1802 1803
		.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,
1804
	},
1805
	.ring = {
1806 1807 1808 1809 1810 1811
		[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,
1812 1813
		[TN_RING_TYPE_VCE1_INDEX] = &trinity_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &trinity_vce_ring,
1814 1815 1816 1817 1818 1819 1820 1821 1822
	},
	.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,
1823
		.set_backlight_level = &atombios_set_backlight_level,
1824
		.get_backlight_level = &atombios_get_backlight_level,
1825 1826
	},
	.copy = {
1827
		.blit = &r600_copy_cpdma,
1828
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1829 1830
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1831 1832
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856
	},
	.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,
1857
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1858
		.set_vce_clocks = &tn_set_vce_clocks,
1859
		.get_temperature = &tn_get_temp,
1860
	},
1861 1862 1863 1864
	.dpm = {
		.init = &trinity_dpm_init,
		.setup_asic = &trinity_dpm_setup_asic,
		.enable = &trinity_dpm_enable,
1865
		.late_enable = &trinity_dpm_late_enable,
1866
		.disable = &trinity_dpm_disable,
1867
		.pre_set_power_state = &trinity_dpm_pre_set_power_state,
1868
		.set_power_state = &trinity_dpm_set_power_state,
1869
		.post_set_power_state = &trinity_dpm_post_set_power_state,
1870 1871 1872 1873 1874
		.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,
1875
		.debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level,
1876
		.force_performance_level = &trinity_dpm_force_performance_level,
1877
		.enable_bapm = &trinity_dpm_enable_bapm,
1878 1879
		.get_current_sclk = &trinity_dpm_get_current_sclk,
		.get_current_mclk = &trinity_dpm_get_current_mclk,
1880
	},
1881 1882
	.pflip = {
		.page_flip = &evergreen_page_flip,
1883
		.page_flip_pending = &evergreen_page_flip_pending,
1884 1885 1886
	},
};

1887
static const struct radeon_asic_ring si_gfx_ring = {
1888 1889 1890 1891 1892 1893 1894 1895 1896
	.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,
1897 1898 1899
	.get_rptr = &cayman_gfx_get_rptr,
	.get_wptr = &cayman_gfx_get_wptr,
	.set_wptr = &cayman_gfx_set_wptr,
1900 1901
};

1902
static const struct radeon_asic_ring si_dma_ring = {
1903 1904 1905 1906 1907 1908 1909 1910 1911
	.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,
1912 1913 1914
	.get_rptr = &cayman_dma_get_rptr,
	.get_wptr = &cayman_dma_get_wptr,
	.set_wptr = &cayman_dma_set_wptr,
1915 1916
};

1917 1918 1919 1920 1921 1922 1923
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,
1924
	.mmio_hdp_flush = r600_mmio_hdp_flush,
1925 1926
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1927
	.get_xclk = &si_get_xclk,
1928
	.get_gpu_clock_counter = &si_get_gpu_clock_counter,
1929
	.get_allowed_info_register = si_get_allowed_info_register,
1930 1931
	.gart = {
		.tlb_flush = &si_pcie_gart_tlb_flush,
1932
		.get_page_entry = &rs600_gart_get_page_entry,
1933 1934
		.set_page = &rs600_gart_set_page,
	},
1935 1936 1937
	.vm = {
		.init = &si_vm_init,
		.fini = &si_vm_fini,
1938 1939 1940 1941
		.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,
1942
	},
1943
	.ring = {
1944 1945 1946 1947 1948 1949
		[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,
1950 1951
		[TN_RING_TYPE_VCE1_INDEX] = &trinity_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &trinity_vce_ring,
1952 1953 1954 1955 1956 1957 1958 1959 1960
	},
	.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,
1961
		.set_backlight_level = &atombios_set_backlight_level,
1962
		.get_backlight_level = &atombios_get_backlight_level,
1963 1964
	},
	.copy = {
1965
		.blit = &r600_copy_cpdma,
1966
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1967 1968
		.dma = &si_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1969 1970
		.copy = &si_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991
	},
	.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,
1992 1993
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1994
		.set_clock_gating = NULL,
1995
		.set_uvd_clocks = &si_set_uvd_clocks,
1996
		.set_vce_clocks = &si_set_vce_clocks,
1997
		.get_temperature = &si_get_temp,
1998
	},
1999 2000 2001 2002
	.dpm = {
		.init = &si_dpm_init,
		.setup_asic = &si_dpm_setup_asic,
		.enable = &si_dpm_enable,
2003
		.late_enable = &si_dpm_late_enable,
2004 2005 2006 2007 2008 2009 2010 2011 2012
		.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,
2013
		.debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
2014
		.force_performance_level = &si_dpm_force_performance_level,
2015
		.vblank_too_short = &ni_dpm_vblank_too_short,
2016 2017 2018 2019
		.fan_ctrl_set_mode = &si_fan_ctrl_set_mode,
		.fan_ctrl_get_mode = &si_fan_ctrl_get_mode,
		.get_fan_speed_percent = &si_fan_ctrl_get_fan_speed_percent,
		.set_fan_speed_percent = &si_fan_ctrl_set_fan_speed_percent,
2020 2021
		.get_current_sclk = &si_dpm_get_current_sclk,
		.get_current_mclk = &si_dpm_get_current_mclk,
2022
	},
2023 2024
	.pflip = {
		.page_flip = &evergreen_page_flip,
2025
		.page_flip_pending = &evergreen_page_flip_pending,
2026 2027 2028
	},
};

2029
static const struct radeon_asic_ring ci_gfx_ring = {
2030 2031 2032 2033 2034 2035 2036 2037 2038
	.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,
2039 2040 2041
	.get_rptr = &cik_gfx_get_rptr,
	.get_wptr = &cik_gfx_get_wptr,
	.set_wptr = &cik_gfx_set_wptr,
2042 2043
};

2044
static const struct radeon_asic_ring ci_cp_ring = {
2045 2046 2047 2048 2049 2050 2051 2052 2053
	.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,
2054 2055 2056
	.get_rptr = &cik_compute_get_rptr,
	.get_wptr = &cik_compute_get_wptr,
	.set_wptr = &cik_compute_set_wptr,
2057 2058
};

2059
static const struct radeon_asic_ring ci_dma_ring = {
2060 2061 2062 2063 2064 2065 2066 2067 2068
	.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,
2069 2070 2071
	.get_rptr = &cik_sdma_get_rptr,
	.get_wptr = &cik_sdma_get_wptr,
	.set_wptr = &cik_sdma_set_wptr,
2072 2073
};

2074
static const struct radeon_asic_ring ci_vce_ring = {
2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
	.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,
};

2087 2088 2089 2090 2091 2092 2093
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,
2094
	.mmio_hdp_flush = &r600_mmio_hdp_flush,
2095 2096 2097 2098
	.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,
2099
	.get_allowed_info_register = cik_get_allowed_info_register,
2100 2101
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
2102
		.get_page_entry = &rs600_gart_get_page_entry,
2103 2104 2105 2106 2107
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
2108 2109 2110 2111
		.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,
2112 2113
	},
	.ring = {
2114 2115 2116 2117 2118 2119
		[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,
2120 2121
		[TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
2122 2123 2124 2125 2126 2127 2128 2129 2130
	},
	.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,
2131 2132
		.set_backlight_level = &atombios_set_backlight_level,
		.get_backlight_level = &atombios_get_backlight_level,
2133 2134
	},
	.copy = {
2135
		.blit = &cik_copy_cpdma,
2136 2137 2138
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &cik_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
2139 2140
		.copy = &cik_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165
	},
	.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,
2166
		.set_vce_clocks = &cik_set_vce_clocks,
2167
		.get_temperature = &ci_get_temp,
2168
	},
2169 2170 2171 2172
	.dpm = {
		.init = &ci_dpm_init,
		.setup_asic = &ci_dpm_setup_asic,
		.enable = &ci_dpm_enable,
2173
		.late_enable = &ci_dpm_late_enable,
2174 2175 2176 2177 2178 2179 2180 2181 2182
		.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,
2183
		.debugfs_print_current_performance_level = &ci_dpm_debugfs_print_current_performance_level,
2184
		.force_performance_level = &ci_dpm_force_performance_level,
2185
		.vblank_too_short = &ci_dpm_vblank_too_short,
2186
		.powergate_uvd = &ci_dpm_powergate_uvd,
2187 2188 2189 2190
		.fan_ctrl_set_mode = &ci_fan_ctrl_set_mode,
		.fan_ctrl_get_mode = &ci_fan_ctrl_get_mode,
		.get_fan_speed_percent = &ci_fan_ctrl_get_fan_speed_percent,
		.set_fan_speed_percent = &ci_fan_ctrl_set_fan_speed_percent,
2191 2192
		.get_current_sclk = &ci_dpm_get_current_sclk,
		.get_current_mclk = &ci_dpm_get_current_mclk,
2193
	},
2194 2195
	.pflip = {
		.page_flip = &evergreen_page_flip,
2196
		.page_flip_pending = &evergreen_page_flip_pending,
2197 2198 2199 2200 2201 2202 2203 2204 2205 2206
	},
};

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,
2207
	.mmio_hdp_flush = &r600_mmio_hdp_flush,
2208 2209 2210 2211
	.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,
2212
	.get_allowed_info_register = cik_get_allowed_info_register,
2213 2214
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
2215
		.get_page_entry = &rs600_gart_get_page_entry,
2216 2217 2218 2219 2220
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
2221 2222 2223 2224
		.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,
2225 2226
	},
	.ring = {
2227 2228 2229 2230 2231 2232
		[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,
2233 2234
		[TN_RING_TYPE_VCE1_INDEX] = &ci_vce_ring,
		[TN_RING_TYPE_VCE2_INDEX] = &ci_vce_ring,
2235 2236 2237 2238 2239 2240 2241 2242 2243
	},
	.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,
2244 2245
		.set_backlight_level = &atombios_set_backlight_level,
		.get_backlight_level = &atombios_get_backlight_level,
2246 2247
	},
	.copy = {
2248
		.blit = &cik_copy_cpdma,
2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278
		.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,
2279
		.set_vce_clocks = &cik_set_vce_clocks,
2280
		.get_temperature = &kv_get_temp,
2281
	},
2282 2283 2284 2285
	.dpm = {
		.init = &kv_dpm_init,
		.setup_asic = &kv_dpm_setup_asic,
		.enable = &kv_dpm_enable,
2286
		.late_enable = &kv_dpm_late_enable,
2287 2288 2289 2290 2291 2292 2293 2294 2295
		.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,
2296
		.debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level,
2297
		.force_performance_level = &kv_dpm_force_performance_level,
2298
		.powergate_uvd = &kv_dpm_powergate_uvd,
2299
		.enable_bapm = &kv_dpm_enable_bapm,
2300 2301
		.get_current_sclk = &kv_dpm_get_current_sclk,
		.get_current_mclk = &kv_dpm_get_current_mclk,
2302
	},
2303 2304
	.pflip = {
		.page_flip = &evergreen_page_flip,
2305
		.page_flip_pending = &evergreen_page_flip_pending,
2306 2307 2308
	},
};

2309 2310 2311 2312 2313 2314 2315 2316 2317 2318
/**
 * 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 已提交
2319 2320 2321
int radeon_asic_init(struct radeon_device *rdev)
{
	radeon_register_accessor_init(rdev);
2322 2323 2324 2325 2326 2327 2328

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

2329
	rdev->has_uvd = false;
2330
	rdev->has_vce = false;
2331

D
Daniel Vetter 已提交
2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358
	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;
2359 2360
		/* handle macs */
		if (rdev->bios == NULL) {
2361 2362 2363 2364
			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;
2365
			rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level;
2366
		}
D
Daniel Vetter 已提交
2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389
		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:
2390 2391
		rdev->asic = &r600_asic;
		break;
D
Daniel Vetter 已提交
2392 2393 2394 2395 2396
	case CHIP_RV610:
	case CHIP_RV630:
	case CHIP_RV620:
	case CHIP_RV635:
	case CHIP_RV670:
2397 2398
		rdev->asic = &rv6xx_asic;
		rdev->has_uvd = true;
2399
		break;
D
Daniel Vetter 已提交
2400 2401
	case CHIP_RS780:
	case CHIP_RS880:
2402
		rdev->asic = &rs780_asic;
2403 2404 2405 2406 2407 2408 2409 2410 2411
		/* 760G/780V/880V don't have UVD */
		if ((rdev->pdev->device == 0x9616)||
		    (rdev->pdev->device == 0x9611)||
		    (rdev->pdev->device == 0x9613)||
		    (rdev->pdev->device == 0x9711)||
		    (rdev->pdev->device == 0x9713))
			rdev->has_uvd = false;
		else
			rdev->has_uvd = true;
D
Daniel Vetter 已提交
2412 2413 2414 2415 2416 2417
		break;
	case CHIP_RV770:
	case CHIP_RV730:
	case CHIP_RV710:
	case CHIP_RV740:
		rdev->asic = &rv770_asic;
2418
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2419 2420 2421 2422 2423 2424
		break;
	case CHIP_CEDAR:
	case CHIP_REDWOOD:
	case CHIP_JUNIPER:
	case CHIP_CYPRESS:
	case CHIP_HEMLOCK:
2425 2426 2427 2428 2429
		/* set num crtcs */
		if (rdev->family == CHIP_CEDAR)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
D
Daniel Vetter 已提交
2430
		rdev->asic = &evergreen_asic;
2431
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2432
		break;
2433
	case CHIP_PALM:
2434 2435
	case CHIP_SUMO:
	case CHIP_SUMO2:
2436
		rdev->asic = &sumo_asic;
2437
		rdev->has_uvd = true;
2438
		break;
2439 2440 2441
	case CHIP_BARTS:
	case CHIP_TURKS:
	case CHIP_CAICOS:
2442 2443 2444 2445 2446
		/* set num crtcs */
		if (rdev->family == CHIP_CAICOS)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
2447
		rdev->asic = &btc_asic;
2448
		rdev->has_uvd = true;
2449
		break;
2450 2451
	case CHIP_CAYMAN:
		rdev->asic = &cayman_asic;
2452 2453
		/* set num crtcs */
		rdev->num_crtc = 6;
2454
		rdev->has_uvd = true;
2455
		break;
2456 2457 2458 2459
	case CHIP_ARUBA:
		rdev->asic = &trinity_asic;
		/* set num crtcs */
		rdev->num_crtc = 4;
2460
		rdev->has_uvd = true;
2461
		rdev->has_vce = true;
2462 2463
		rdev->cg_flags =
			RADEON_CG_SUPPORT_VCE_MGCG;
2464
		break;
2465 2466 2467
	case CHIP_TAHITI:
	case CHIP_PITCAIRN:
	case CHIP_VERDE:
2468
	case CHIP_OLAND:
2469
	case CHIP_HAINAN:
2470 2471
		rdev->asic = &si_asic;
		/* set num crtcs */
2472 2473 2474
		if (rdev->family == CHIP_HAINAN)
			rdev->num_crtc = 0;
		else if (rdev->family == CHIP_OLAND)
2475 2476 2477
			rdev->num_crtc = 2;
		else
			rdev->num_crtc = 6;
2478
		if (rdev->family == CHIP_HAINAN) {
2479
			rdev->has_uvd = false;
2480 2481
			rdev->has_vce = false;
		} else {
2482
			rdev->has_uvd = true;
2483 2484
			rdev->has_vce = true;
		}
2485 2486 2487
		switch (rdev->family) {
		case CHIP_TAHITI:
			rdev->cg_flags =
A
Alex Deucher 已提交
2488
				RADEON_CG_SUPPORT_GFX_MGCG |
2489
				RADEON_CG_SUPPORT_GFX_MGLS |
2490
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504
				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 已提交
2505
				RADEON_CG_SUPPORT_GFX_MGCG |
2506
				RADEON_CG_SUPPORT_GFX_MGLS |
2507
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523
				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 已提交
2524
				RADEON_CG_SUPPORT_GFX_MGCG |
2525
				RADEON_CG_SUPPORT_GFX_MGLS |
2526
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538
				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;
2539
			rdev->pg_flags = 0 |
A
Alex Deucher 已提交
2540
				/*RADEON_PG_SUPPORT_GFX_PG | */
2541
				RADEON_PG_SUPPORT_SDMA;
2542 2543 2544
			break;
		case CHIP_OLAND:
			rdev->cg_flags =
A
Alex Deucher 已提交
2545
				RADEON_CG_SUPPORT_GFX_MGCG |
2546
				RADEON_CG_SUPPORT_GFX_MGLS |
2547
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2548 2549 2550 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_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 已提交
2563
				RADEON_CG_SUPPORT_GFX_MGCG |
2564
				RADEON_CG_SUPPORT_GFX_MGLS |
2565
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582
				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;
		}
2583
		break;
2584
	case CHIP_BONAIRE:
2585
	case CHIP_HAWAII:
2586 2587
		rdev->asic = &ci_asic;
		rdev->num_crtc = 6;
2588
		rdev->has_uvd = true;
2589
		rdev->has_vce = true;
2590 2591 2592 2593
		if (rdev->family == CHIP_BONAIRE) {
			rdev->cg_flags =
				RADEON_CG_SUPPORT_GFX_MGCG |
				RADEON_CG_SUPPORT_GFX_MGLS |
2594
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612
				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 |
2613
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627
				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;
		}
2628 2629 2630
		break;
	case CHIP_KAVERI:
	case CHIP_KABINI:
S
Samuel Li 已提交
2631
	case CHIP_MULLINS:
2632 2633
		rdev->asic = &kv_asic;
		/* set num crtcs */
2634
		if (rdev->family == CHIP_KAVERI) {
2635
			rdev->num_crtc = 4;
2636
			rdev->cg_flags =
A
Alex Deucher 已提交
2637
				RADEON_CG_SUPPORT_GFX_MGCG |
2638
				RADEON_CG_SUPPORT_GFX_MGLS |
2639
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651
				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 已提交
2652
				/*RADEON_PG_SUPPORT_GFX_PG |
2653 2654 2655 2656 2657 2658 2659 2660 2661 2662
				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 {
2663
			rdev->num_crtc = 2;
2664
			rdev->cg_flags =
A
Alex Deucher 已提交
2665
				RADEON_CG_SUPPORT_GFX_MGCG |
2666
				RADEON_CG_SUPPORT_GFX_MGLS |
2667
				/*RADEON_CG_SUPPORT_GFX_CGCG |*/
2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679
				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 已提交
2680
				/*RADEON_PG_SUPPORT_GFX_PG |
2681 2682 2683 2684 2685 2686 2687 2688
				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;*/
		}
2689
		rdev->has_uvd = true;
2690
		rdev->has_vce = true;
2691
		break;
D
Daniel Vetter 已提交
2692 2693 2694 2695 2696 2697
	default:
		/* FIXME: not supported yet */
		return -EINVAL;
	}

	if (rdev->flags & RADEON_IS_IGP) {
2698 2699
		rdev->asic->pm.get_memory_clock = NULL;
		rdev->asic->pm.set_memory_clock = NULL;
D
Daniel Vetter 已提交
2700 2701
	}

2702 2703
	if (!radeon_uvd)
		rdev->has_uvd = false;
2704 2705
	if (!radeon_vce)
		rdev->has_vce = false;
2706

D
Daniel Vetter 已提交
2707 2708 2709
	return 0;
}