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

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

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

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

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

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

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


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

/*
 * ASIC
 */
175 176 177 178 179 180
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,
181
	.asic_reset = &r100_asic_reset,
182 183 184
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
185 186 187 188
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
189 190 191 192 193
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r100_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
194
			.cs_parse = &r100_cs_parse,
195 196 197
			.ring_start = &r100_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
198
			.is_lockup = &r100_gpu_is_lockup,
199 200 201
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
202 203
		}
	},
204 205 206 207
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
208 209 210 211
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
212
		.set_backlight_level = &radeon_legacy_set_backlight_level,
213
		.get_backlight_level = &radeon_legacy_get_backlight_level,
214
	},
215 216 217 218 219 220 221 222
	.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,
	},
223 224 225 226
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
227 228 229 230 231 232
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
233 234 235 236 237 238
	.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,
239 240 241 242 243 244 245
		.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,
246
	},
247 248 249 250 251
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
252 253 254 255 256 257 258 259
};

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,
260
	.asic_reset = &r100_asic_reset,
261 262 263
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
264 265 266 267
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
268 269 270 271 272
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r100_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
273
			.cs_parse = &r100_cs_parse,
274 275 276
			.ring_start = &r100_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
277
			.is_lockup = &r100_gpu_is_lockup,
278 279 280
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
281 282
		}
	},
283 284 285 286
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
287 288 289 290
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
291
		.set_backlight_level = &radeon_legacy_set_backlight_level,
292
		.get_backlight_level = &radeon_legacy_get_backlight_level,
293
	},
294 295 296 297 298 299 300 301
	.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,
	},
302 303 304 305
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
306 307 308 309 310 311
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
312 313 314 315 316 317
	.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,
318 319 320 321 322 323 324
		.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,
325
	},
326 327 328 329 330
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
331 332 333 334 335 336 337 338
};

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,
339
	.asic_reset = &r300_asic_reset,
340 341 342
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
343 344 345 346
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
347 348 349 350 351
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
352
			.cs_parse = &r300_cs_parse,
353 354 355
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
356
			.is_lockup = &r100_gpu_is_lockup,
357 358 359
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
360 361
		}
	},
362 363 364 365
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
366 367 368 369
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
370
		.set_backlight_level = &radeon_legacy_set_backlight_level,
371
		.get_backlight_level = &radeon_legacy_get_backlight_level,
372
	},
373 374 375 376 377 378 379 380
	.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,
	},
381 382 383 384
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
385 386 387 388 389 390
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
391 392 393 394 395 396
	.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,
397 398 399 400 401 402 403
		.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,
404
	},
405 406 407 408 409
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
410 411 412 413 414 415 416 417
};

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,
418
	.asic_reset = &r300_asic_reset,
419 420 421
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
422 423 424 425
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
426 427 428 429 430
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
431
			.cs_parse = &r300_cs_parse,
432 433 434
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
435
			.is_lockup = &r100_gpu_is_lockup,
436 437 438
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
439 440
		}
	},
441 442 443 444
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
445 446 447 448
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
449
		.set_backlight_level = &radeon_legacy_set_backlight_level,
450
		.get_backlight_level = &radeon_legacy_get_backlight_level,
451
	},
452 453 454 455 456 457 458 459
	.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,
	},
460 461 462 463
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
464 465 466 467 468 469
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
470 471 472 473 474 475
	.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,
476 477 478 479 480 481 482
		.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,
483
	},
484 485 486 487 488
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
489 490 491 492 493 494 495 496
};

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,
497
	.asic_reset = &r300_asic_reset,
498 499 500
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
501 502 503 504
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
505 506 507 508 509
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
510
			.cs_parse = &r300_cs_parse,
511 512 513
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
514
			.is_lockup = &r100_gpu_is_lockup,
515 516 517
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
518 519
		}
	},
520 521 522 523
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
524 525 526 527
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
528
		.set_backlight_level = &atombios_set_backlight_level,
529
		.get_backlight_level = &atombios_get_backlight_level,
530
	},
531 532 533 534 535 536 537 538
	.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,
	},
539 540 541 542
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
543 544 545 546 547 548
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
549 550 551 552 553 554
	.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,
555 556 557 558 559 560 561
		.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,
562
	},
563 564 565 566 567
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
568 569 570 571 572 573 574 575
};

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,
576
	.asic_reset = &r300_asic_reset,
577 578 579
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs400_mc_wait_for_idle,
580 581 582 583
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
584 585 586 587 588
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
589
			.cs_parse = &r300_cs_parse,
590 591 592
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
593
			.is_lockup = &r100_gpu_is_lockup,
594 595 596
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
597 598
		}
	},
599 600 601 602
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
603 604 605 606
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
607
		.set_backlight_level = &radeon_legacy_set_backlight_level,
608
		.get_backlight_level = &radeon_legacy_get_backlight_level,
609
	},
610 611 612 613 614 615 616 617
	.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,
	},
618 619 620 621
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
622 623 624 625 626 627
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
628 629 630 631 632 633
	.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,
634 635 636 637 638 639 640
		.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,
641
	},
642 643 644 645 646
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
647 648 649 650 651 652 653 654
};

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,
655
	.asic_reset = &rs600_asic_reset,
656 657 658
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs600_mc_wait_for_idle,
659 660 661 662
	.gart = {
		.tlb_flush = &rs600_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
663 664 665 666 667
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
668
			.cs_parse = &r300_cs_parse,
669 670 671
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
672
			.is_lockup = &r100_gpu_is_lockup,
673 674 675
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
676 677
		}
	},
678 679 680 681
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
682 683 684 685
	.display = {
		.bandwidth_update = &rs600_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
686
		.set_backlight_level = &atombios_set_backlight_level,
687
		.get_backlight_level = &atombios_get_backlight_level,
688 689
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
690
	},
691 692 693 694 695 696 697 698
	.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,
	},
699 700 701 702
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
703 704 705 706 707 708
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
709 710 711 712 713 714
	.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,
715 716 717 718 719 720 721
		.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,
722
	},
723 724 725 726 727
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
728 729 730 731 732 733 734 735
};

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,
736
	.asic_reset = &rs600_asic_reset,
737 738 739
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs690_mc_wait_for_idle,
740 741 742 743
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
744 745 746 747 748
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
749
			.cs_parse = &r300_cs_parse,
750 751 752
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
753
			.is_lockup = &r100_gpu_is_lockup,
754 755 756
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
757 758
		}
	},
759 760 761 762
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
763 764 765 766
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rs690_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
767
		.set_backlight_level = &atombios_set_backlight_level,
768
		.get_backlight_level = &atombios_get_backlight_level,
769 770
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
771
	},
772 773 774 775 776 777 778 779
	.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,
	},
780 781 782 783
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
784 785 786 787 788 789
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
790 791 792 793 794 795
	.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,
796 797 798 799 800 801 802
		.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,
803
	},
804 805 806 807 808
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
809 810 811 812 813 814 815 816
};

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,
817
	.asic_reset = &rs600_asic_reset,
818 819 820
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rv515_mc_wait_for_idle,
821 822 823 824
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
825 826 827 828 829
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
830
			.cs_parse = &r300_cs_parse,
831 832 833
			.ring_start = &rv515_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
834
			.is_lockup = &r100_gpu_is_lockup,
835 836 837
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
838 839
		}
	},
840 841 842 843
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
844 845 846 847
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rv515_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
848
		.set_backlight_level = &atombios_set_backlight_level,
849
		.get_backlight_level = &atombios_get_backlight_level,
850
	},
851 852 853 854 855 856 857 858
	.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,
	},
859 860 861 862
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
863 864 865 866 867 868
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
869 870 871 872 873 874
	.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,
875 876 877 878 879 880 881
		.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,
882
	},
883 884 885 886 887
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
888 889 890 891 892 893 894 895
};

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,
896
	.asic_reset = &rs600_asic_reset,
897 898 899
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r520_mc_wait_for_idle,
900 901 902 903
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
904 905 906 907 908
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
909
			.cs_parse = &r300_cs_parse,
910 911 912
			.ring_start = &rv515_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
913
			.is_lockup = &r100_gpu_is_lockup,
914 915 916
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
917 918
		}
	},
919 920 921 922
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
923 924 925 926
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
927
		.set_backlight_level = &atombios_set_backlight_level,
928
		.get_backlight_level = &atombios_get_backlight_level,
929
	},
930 931 932 933 934 935 936 937
	.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,
	},
938 939 940 941
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
942 943 944 945 946 947
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
948 949 950 951 952 953
	.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,
954 955 956 957 958 959 960
		.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,
961
	},
962 963 964 965 966
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
967 968 969 970 971 972 973 974
};

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,
975
	.asic_reset = &r600_asic_reset,
976 977 978
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
979
	.get_xclk = &r600_get_xclk,
980
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
981 982 983 984
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
985 986 987 988 989
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
990
			.cs_parse = &r600_cs_parse,
991 992
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
993
			.is_lockup = &r600_gfx_is_lockup,
994 995 996
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
997 998 999 1000 1001
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &r600_dma_ring_ib_execute,
			.emit_fence = &r600_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1002
			.cs_parse = &r600_dma_cs_parse,
1003 1004 1005
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
1006 1007 1008
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1009 1010
		}
	},
1011 1012 1013 1014
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1015 1016 1017 1018
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1019
		.set_backlight_level = &atombios_set_backlight_level,
1020
		.get_backlight_level = &atombios_get_backlight_level,
1021 1022
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
1023
	},
1024 1025 1026
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1027 1028
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1029
		.copy = &r600_copy_cpdma,
1030
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1031
	},
1032 1033 1034 1035
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1036 1037 1038 1039 1040 1041
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1042 1043 1044 1045 1046 1047
	.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,
1048 1049 1050 1051 1052 1053 1054
		.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,
1055
		.get_temperature = &rv6xx_get_temp,
1056
	},
1057 1058 1059 1060 1061
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1062 1063
};

1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
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,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
	.get_xclk = &r600_get_xclk,
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		}
	},
	.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 = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1122
		.copy = &r600_copy_cpdma,
1123
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
	},
	.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,
	},
1150 1151 1152 1153 1154
	.dpm = {
		.init = &rv6xx_dpm_init,
		.setup_asic = &rv6xx_setup_asic,
		.enable = &rv6xx_dpm_enable,
		.disable = &rv6xx_dpm_disable,
1155
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1156
		.set_power_state = &rv6xx_dpm_set_power_state,
1157
		.post_set_power_state = &r600_dpm_post_set_power_state,
1158 1159 1160 1161 1162
		.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,
1163
		.debugfs_print_current_performance_level = &rv6xx_dpm_debugfs_print_current_performance_level,
1164
	},
1165 1166 1167 1168 1169 1170 1171
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
};

1172 1173 1174 1175 1176 1177
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,
1178
	.asic_reset = &r600_asic_reset,
1179 1180 1181
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1182
	.get_xclk = &r600_get_xclk,
1183
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1184 1185 1186 1187
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1188 1189 1190 1191 1192
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1193
			.cs_parse = &r600_cs_parse,
1194 1195
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1196
			.is_lockup = &r600_gfx_is_lockup,
1197 1198 1199
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1200 1201 1202 1203 1204
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &r600_dma_ring_ib_execute,
			.emit_fence = &r600_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1205
			.cs_parse = &r600_dma_cs_parse,
1206 1207 1208
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
1209 1210 1211
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1212 1213
		}
	},
1214 1215 1216 1217
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1218 1219 1220 1221
	.display = {
		.bandwidth_update = &rs690_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1222
		.set_backlight_level = &atombios_set_backlight_level,
1223
		.get_backlight_level = &atombios_get_backlight_level,
1224 1225
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
1226
	},
1227 1228 1229
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1230 1231
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1232
		.copy = &r600_copy_cpdma,
1233
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1234
	},
1235 1236 1237 1238
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1239 1240 1241 1242 1243 1244
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1245 1246 1247 1248 1249 1250
	.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,
1251 1252 1253 1254 1255 1256 1257
		.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,
1258
		.get_temperature = &rv6xx_get_temp,
1259
	},
1260 1261 1262 1263 1264
	.dpm = {
		.init = &rs780_dpm_init,
		.setup_asic = &rs780_dpm_setup_asic,
		.enable = &rs780_dpm_enable,
		.disable = &rs780_dpm_disable,
1265
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1266
		.set_power_state = &rs780_dpm_set_power_state,
1267
		.post_set_power_state = &r600_dpm_post_set_power_state,
1268 1269 1270 1271 1272
		.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,
1273
		.debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level,
1274
	},
1275 1276 1277 1278 1279
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1280 1281
};

1282 1283 1284 1285 1286
static struct radeon_asic rv770_asic = {
	.init = &rv770_init,
	.fini = &rv770_fini,
	.suspend = &rv770_suspend,
	.resume = &rv770_resume,
1287
	.asic_reset = &r600_asic_reset,
1288
	.vga_set_state = &r600_vga_set_state,
1289 1290 1291
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1292
	.get_xclk = &rv770_get_xclk,
1293
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1294 1295 1296 1297
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1298 1299 1300 1301 1302
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1303
			.cs_parse = &r600_cs_parse,
1304 1305
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1306
			.is_lockup = &r600_gfx_is_lockup,
1307 1308 1309
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1310 1311 1312 1313 1314
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &r600_dma_ring_ib_execute,
			.emit_fence = &r600_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1315
			.cs_parse = &r600_dma_cs_parse,
1316 1317 1318
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
1319 1320 1321
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
1322 1323 1324 1325 1326 1327 1328 1329 1330
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &r600_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
1331 1332 1333
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1334 1335
		}
	},
1336 1337 1338 1339
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1340 1341 1342 1343
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1344
		.set_backlight_level = &atombios_set_backlight_level,
1345
		.get_backlight_level = &atombios_get_backlight_level,
1346 1347
		.hdmi_enable = &r600_hdmi_enable,
		.hdmi_setmode = &r600_hdmi_setmode,
1348
	},
1349 1350 1351
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1352
		.dma = &rv770_copy_dma,
1353
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1354
		.copy = &rv770_copy_dma,
1355
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1356
	},
1357 1358 1359 1360
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1361 1362 1363 1364 1365 1366
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1367 1368 1369 1370 1371 1372
	.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,
1373 1374 1375 1376 1377 1378 1379
		.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,
1380
		.set_uvd_clocks = &rv770_set_uvd_clocks,
1381
		.get_temperature = &rv770_get_temp,
1382
	},
1383 1384 1385 1386 1387
	.dpm = {
		.init = &rv770_dpm_init,
		.setup_asic = &rv770_dpm_setup_asic,
		.enable = &rv770_dpm_enable,
		.disable = &rv770_dpm_disable,
1388
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1389
		.set_power_state = &rv770_dpm_set_power_state,
1390
		.post_set_power_state = &r600_dpm_post_set_power_state,
1391 1392 1393 1394 1395
		.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,
1396
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1397
		.force_performance_level = &rv770_dpm_force_performance_level,
1398
		.vblank_too_short = &rv770_dpm_vblank_too_short,
1399
	},
1400 1401 1402 1403 1404
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rv770_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1405 1406 1407 1408 1409 1410 1411
};

static struct radeon_asic evergreen_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
1412
	.asic_reset = &evergreen_asic_reset,
1413
	.vga_set_state = &r600_vga_set_state,
1414 1415 1416
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1417
	.get_xclk = &rv770_get_xclk,
1418
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1419 1420 1421 1422
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1423 1424 1425 1426 1427
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1428
			.cs_parse = &evergreen_cs_parse,
1429 1430
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1431
			.is_lockup = &evergreen_gfx_is_lockup,
1432 1433 1434
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1435 1436 1437 1438 1439
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &evergreen_dma_ring_ib_execute,
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1440
			.cs_parse = &evergreen_dma_cs_parse,
1441 1442
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1443
			.is_lockup = &evergreen_dma_is_lockup,
1444 1445 1446
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
1447 1448 1449 1450 1451 1452 1453 1454 1455
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &r600_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
1456 1457 1458
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1459 1460
		}
	},
1461 1462 1463 1464
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1465 1466 1467 1468
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1469
		.set_backlight_level = &atombios_set_backlight_level,
1470
		.get_backlight_level = &atombios_get_backlight_level,
1471 1472
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1473
	},
1474 1475 1476
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1477 1478
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1479 1480
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1481
	},
1482 1483 1484 1485
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1486 1487 1488 1489 1490 1491
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1492 1493 1494 1495 1496 1497
	.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,
1498 1499 1500 1501 1502 1503 1504
		.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,
1505
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1506
		.get_temperature = &evergreen_get_temp,
1507
	},
1508 1509 1510 1511 1512
	.dpm = {
		.init = &cypress_dpm_init,
		.setup_asic = &cypress_dpm_setup_asic,
		.enable = &cypress_dpm_enable,
		.disable = &cypress_dpm_disable,
1513
		.pre_set_power_state = &r600_dpm_pre_set_power_state,
1514
		.set_power_state = &cypress_dpm_set_power_state,
1515
		.post_set_power_state = &r600_dpm_post_set_power_state,
1516 1517 1518 1519 1520
		.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,
1521
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1522
		.force_performance_level = &rv770_dpm_force_performance_level,
1523
		.vblank_too_short = &cypress_dpm_vblank_too_short,
1524
	},
1525 1526 1527 1528 1529
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1530 1531
};

1532 1533 1534 1535 1536 1537 1538
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,
1539 1540 1541
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1542
	.get_xclk = &r600_get_xclk,
1543
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1544 1545 1546 1547
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1548 1549 1550 1551 1552
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1553
			.cs_parse = &evergreen_cs_parse,
1554 1555
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1556
			.is_lockup = &evergreen_gfx_is_lockup,
1557 1558 1559
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1560
		},
1561 1562 1563 1564
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &evergreen_dma_ring_ib_execute,
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1565
			.cs_parse = &evergreen_dma_cs_parse,
1566 1567
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1568
			.is_lockup = &evergreen_dma_is_lockup,
1569 1570 1571
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
1572 1573 1574 1575 1576 1577 1578 1579 1580
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &r600_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
1581 1582 1583
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1584
		}
1585
	},
1586 1587 1588 1589
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1590 1591 1592 1593
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1594
		.set_backlight_level = &atombios_set_backlight_level,
1595
		.get_backlight_level = &atombios_get_backlight_level,
1596 1597
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1598
	},
1599 1600 1601
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1602 1603
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1604 1605
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1606
	},
1607 1608 1609 1610
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1611 1612 1613 1614 1615 1616
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1617 1618 1619 1620 1621 1622
	.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,
1623 1624 1625 1626 1627 1628 1629
		.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,
1630
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1631
		.get_temperature = &sumo_get_temp,
1632
	},
1633 1634 1635 1636 1637
	.dpm = {
		.init = &sumo_dpm_init,
		.setup_asic = &sumo_dpm_setup_asic,
		.enable = &sumo_dpm_enable,
		.disable = &sumo_dpm_disable,
1638
		.pre_set_power_state = &sumo_dpm_pre_set_power_state,
1639
		.set_power_state = &sumo_dpm_set_power_state,
1640
		.post_set_power_state = &sumo_dpm_post_set_power_state,
1641 1642 1643 1644 1645
		.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,
1646
		.debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
1647
		.force_performance_level = &sumo_dpm_force_performance_level,
1648
	},
1649 1650 1651 1652 1653
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1654 1655
};

1656 1657 1658 1659 1660 1661 1662
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,
1663 1664 1665
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1666
	.get_xclk = &rv770_get_xclk,
1667
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1668 1669 1670 1671
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1672 1673 1674 1675 1676
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1677
			.cs_parse = &evergreen_cs_parse,
1678 1679
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1680
			.is_lockup = &evergreen_gfx_is_lockup,
1681 1682 1683
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1684 1685 1686 1687 1688
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &evergreen_dma_ring_ib_execute,
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1689
			.cs_parse = &evergreen_dma_cs_parse,
1690 1691
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1692
			.is_lockup = &evergreen_dma_is_lockup,
1693 1694 1695
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
1696 1697 1698 1699 1700 1701 1702 1703 1704
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &r600_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
1705 1706 1707
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1708 1709
		}
	},
1710 1711 1712 1713
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1714 1715 1716 1717
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1718
		.set_backlight_level = &atombios_set_backlight_level,
1719
		.get_backlight_level = &atombios_get_backlight_level,
1720 1721
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1722
	},
1723 1724 1725
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1726 1727
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1728 1729
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1730
	},
1731 1732 1733 1734
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1735 1736 1737 1738 1739 1740
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1741 1742 1743 1744
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1745
		.init_profile = &btc_pm_init_profile,
1746
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1747 1748 1749 1750
		.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,
1751 1752
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1753
		.set_clock_gating = NULL,
1754
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1755
		.get_temperature = &evergreen_get_temp,
1756
	},
1757 1758 1759 1760 1761
	.dpm = {
		.init = &btc_dpm_init,
		.setup_asic = &btc_dpm_setup_asic,
		.enable = &btc_dpm_enable,
		.disable = &btc_dpm_disable,
1762
		.pre_set_power_state = &btc_dpm_pre_set_power_state,
1763
		.set_power_state = &btc_dpm_set_power_state,
1764
		.post_set_power_state = &btc_dpm_post_set_power_state,
1765 1766
		.display_configuration_changed = &cypress_dpm_display_configuration_changed,
		.fini = &btc_dpm_fini,
1767 1768
		.get_sclk = &btc_dpm_get_sclk,
		.get_mclk = &btc_dpm_get_mclk,
1769
		.print_power_state = &rv770_dpm_print_power_state,
1770
		.debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1771
		.force_performance_level = &rv770_dpm_force_performance_level,
1772
		.vblank_too_short = &btc_dpm_vblank_too_short,
1773
	},
1774 1775 1776 1777 1778
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1779 1780
};

1781 1782 1783 1784 1785 1786 1787
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,
1788 1789 1790
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1791
	.get_xclk = &rv770_get_xclk,
1792
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1793 1794 1795 1796
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1797 1798 1799
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1800
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
1801 1802
		.set_page = &cayman_vm_set_page,
	},
1803 1804
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
1805 1806
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1807
			.emit_fence = &cayman_fence_ring_emit,
1808
			.emit_semaphore = &r600_semaphore_ring_emit,
1809
			.cs_parse = &evergreen_cs_parse,
1810 1811
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1812
			.is_lockup = &cayman_gfx_is_lockup,
1813
			.vm_flush = &cayman_vm_flush,
1814 1815 1816
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1817 1818
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
1819 1820
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1821
			.emit_fence = &cayman_fence_ring_emit,
1822
			.emit_semaphore = &r600_semaphore_ring_emit,
1823
			.cs_parse = &evergreen_cs_parse,
1824 1825
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1826
			.is_lockup = &cayman_gfx_is_lockup,
1827
			.vm_flush = &cayman_vm_flush,
1828 1829 1830
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1831 1832
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
1833 1834
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1835
			.emit_fence = &cayman_fence_ring_emit,
1836
			.emit_semaphore = &r600_semaphore_ring_emit,
1837
			.cs_parse = &evergreen_cs_parse,
1838 1839
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1840
			.is_lockup = &cayman_gfx_is_lockup,
1841
			.vm_flush = &cayman_vm_flush,
1842 1843 1844
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1845 1846 1847
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1848
			.ib_parse = &evergreen_dma_ib_parse,
1849 1850
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1851
			.cs_parse = &evergreen_dma_cs_parse,
1852 1853 1854 1855
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
1856 1857 1858
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1859 1860 1861
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1862
			.ib_parse = &evergreen_dma_ib_parse,
1863 1864
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1865
			.cs_parse = &evergreen_dma_cs_parse,
1866 1867 1868 1869
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
1870 1871 1872
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
1873 1874 1875 1876 1877 1878 1879 1880 1881
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &cayman_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
1882 1883 1884
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1885 1886
		}
	},
1887 1888 1889 1890
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1891 1892 1893 1894
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1895
		.set_backlight_level = &atombios_set_backlight_level,
1896
		.get_backlight_level = &atombios_get_backlight_level,
1897 1898
		.hdmi_enable = &evergreen_hdmi_enable,
		.hdmi_setmode = &evergreen_hdmi_setmode,
1899
	},
1900 1901 1902
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1903 1904
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1905 1906
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1907
	},
1908 1909 1910 1911
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1912 1913 1914 1915 1916 1917
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1918 1919 1920 1921
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1922
		.init_profile = &btc_pm_init_profile,
1923
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1924 1925 1926 1927
		.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,
1928 1929
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
1930
		.set_clock_gating = NULL,
1931
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1932
		.get_temperature = &evergreen_get_temp,
1933
	},
1934 1935 1936 1937 1938
	.dpm = {
		.init = &ni_dpm_init,
		.setup_asic = &ni_dpm_setup_asic,
		.enable = &ni_dpm_enable,
		.disable = &ni_dpm_disable,
1939
		.pre_set_power_state = &ni_dpm_pre_set_power_state,
1940
		.set_power_state = &ni_dpm_set_power_state,
1941
		.post_set_power_state = &ni_dpm_post_set_power_state,
1942 1943 1944 1945 1946
		.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,
1947
		.debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level,
1948
		.force_performance_level = &ni_dpm_force_performance_level,
1949
		.vblank_too_short = &ni_dpm_vblank_too_short,
1950
	},
1951 1952 1953 1954 1955
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1956 1957
};

1958 1959 1960 1961 1962 1963 1964 1965 1966 1967
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,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1968
	.get_xclk = &r600_get_xclk,
1969
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1970 1971 1972 1973
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1974 1975 1976
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1977
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
1978 1979
		.set_page = &cayman_vm_set_page,
	},
1980 1981 1982 1983 1984 1985 1986 1987 1988
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.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,
1989
			.is_lockup = &cayman_gfx_is_lockup,
1990
			.vm_flush = &cayman_vm_flush,
1991 1992 1993
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
1994 1995 1996 1997 1998 1999 2000 2001 2002
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
			.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,
2003
			.is_lockup = &cayman_gfx_is_lockup,
2004
			.vm_flush = &cayman_vm_flush,
2005 2006 2007
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2008 2009 2010 2011 2012 2013 2014 2015 2016
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
			.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,
2017
			.is_lockup = &cayman_gfx_is_lockup,
2018
			.vm_flush = &cayman_vm_flush,
2019 2020 2021
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2022 2023 2024
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
2025
			.ib_parse = &evergreen_dma_ib_parse,
2026 2027
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
2028
			.cs_parse = &evergreen_dma_cs_parse,
2029 2030 2031 2032
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
2033 2034 2035
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2036 2037 2038
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
2039
			.ib_parse = &evergreen_dma_ib_parse,
2040 2041
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
2042
			.cs_parse = &evergreen_dma_cs_parse,
2043 2044 2045 2046
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
2047 2048 2049
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
2050 2051 2052 2053 2054 2055 2056 2057 2058
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &cayman_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
2059 2060 2061
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2062 2063 2064 2065 2066 2067 2068 2069 2070 2071
		}
	},
	.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,
2072
		.set_backlight_level = &atombios_set_backlight_level,
2073
		.get_backlight_level = &atombios_get_backlight_level,
2074 2075 2076 2077
	},
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
2078 2079
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
2080 2081
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105
	},
	.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,
2106
		.set_uvd_clocks = &sumo_set_uvd_clocks,
2107
		.get_temperature = &tn_get_temp,
2108
	},
2109 2110 2111 2112 2113
	.dpm = {
		.init = &trinity_dpm_init,
		.setup_asic = &trinity_dpm_setup_asic,
		.enable = &trinity_dpm_enable,
		.disable = &trinity_dpm_disable,
2114
		.pre_set_power_state = &trinity_dpm_pre_set_power_state,
2115
		.set_power_state = &trinity_dpm_set_power_state,
2116
		.post_set_power_state = &trinity_dpm_post_set_power_state,
2117 2118 2119 2120 2121
		.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,
2122
		.debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level,
2123
		.force_performance_level = &trinity_dpm_force_performance_level,
2124
	},
2125 2126 2127 2128 2129 2130 2131
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

2132 2133 2134 2135 2136 2137 2138 2139 2140 2141
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,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
2142
	.get_xclk = &si_get_xclk,
2143
	.get_gpu_clock_counter = &si_get_gpu_clock_counter,
2144 2145 2146 2147
	.gart = {
		.tlb_flush = &si_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
2148 2149 2150
	.vm = {
		.init = &si_vm_init,
		.fini = &si_vm_fini,
2151
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
2152
		.set_page = &si_vm_set_page,
2153
	},
2154 2155 2156 2157 2158 2159 2160 2161 2162
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.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,
2163
			.is_lockup = &si_gfx_is_lockup,
2164
			.vm_flush = &si_vm_flush,
2165 2166 2167
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2168 2169 2170 2171 2172 2173 2174 2175 2176
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
			.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,
2177
			.is_lockup = &si_gfx_is_lockup,
2178
			.vm_flush = &si_vm_flush,
2179 2180 2181
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2182 2183 2184 2185 2186 2187 2188 2189 2190
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
			.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,
2191
			.is_lockup = &si_gfx_is_lockup,
2192
			.vm_flush = &si_vm_flush,
2193 2194 2195
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2196 2197 2198
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
2199
			.ib_parse = &evergreen_dma_ib_parse,
2200 2201 2202 2203 2204
			.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,
2205
			.is_lockup = &si_dma_is_lockup,
2206
			.vm_flush = &si_dma_vm_flush,
2207 2208 2209
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2210 2211 2212
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
2213
			.ib_parse = &evergreen_dma_ib_parse,
2214 2215 2216 2217 2218
			.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,
2219
			.is_lockup = &si_dma_is_lockup,
2220
			.vm_flush = &si_dma_vm_flush,
2221 2222 2223
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
C
Christian König 已提交
2224 2225 2226 2227 2228 2229 2230 2231 2232
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &cayman_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
2233 2234 2235
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
2236 2237 2238 2239 2240 2241 2242 2243 2244 2245
		}
	},
	.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,
2246
		.set_backlight_level = &atombios_set_backlight_level,
2247
		.get_backlight_level = &atombios_get_backlight_level,
2248 2249 2250 2251
	},
	.copy = {
		.blit = NULL,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
2252 2253
		.dma = &si_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
2254 2255
		.copy = &si_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276
	},
	.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,
2277 2278
		.get_pcie_lanes = &r600_get_pcie_lanes,
		.set_pcie_lanes = &r600_set_pcie_lanes,
2279
		.set_clock_gating = NULL,
2280
		.set_uvd_clocks = &si_set_uvd_clocks,
2281
		.get_temperature = &si_get_temp,
2282
	},
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295
	.dpm = {
		.init = &si_dpm_init,
		.setup_asic = &si_dpm_setup_asic,
		.enable = &si_dpm_enable,
		.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,
2296
		.debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
2297
		.force_performance_level = &si_dpm_force_performance_level,
2298
		.vblank_too_short = &ni_dpm_vblank_too_short,
2299
	},
2300 2301 2302 2303 2304 2305 2306
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 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 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616
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,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
	.get_xclk = &cik_get_xclk,
	.get_gpu_clock_counter = &cik_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
		.set_page = &cik_vm_set_page,
	},
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
			.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,
			.get_rptr = &cik_compute_ring_get_rptr,
			.get_wptr = &cik_compute_ring_get_wptr,
			.set_wptr = &cik_compute_ring_set_wptr,
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
			.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,
			.get_rptr = &cik_compute_ring_get_rptr,
			.get_wptr = &cik_compute_ring_get_wptr,
			.set_wptr = &cik_compute_ring_set_wptr,
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &cayman_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		}
	},
	.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,
	},
	.copy = {
		.blit = NULL,
		.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,
	},
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

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,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
	.get_xclk = &cik_get_xclk,
	.get_gpu_clock_counter = &cik_get_gpu_clock_counter,
	.gart = {
		.tlb_flush = &cik_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
	.vm = {
		.init = &cik_vm_init,
		.fini = &cik_vm_fini,
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
		.set_page = &cik_vm_set_page,
	},
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
			.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,
			.get_rptr = &cik_compute_ring_get_rptr,
			.get_wptr = &cik_compute_ring_get_wptr,
			.set_wptr = &cik_compute_ring_set_wptr,
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
			.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,
			.get_rptr = &cik_compute_ring_get_rptr,
			.get_wptr = &cik_compute_ring_get_wptr,
			.set_wptr = &cik_compute_ring_set_wptr,
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.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,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		},
		[R600_RING_TYPE_UVD_INDEX] = {
			.ib_execute = &r600_uvd_ib_execute,
			.emit_fence = &r600_uvd_fence_emit,
			.emit_semaphore = &cayman_uvd_semaphore_emit,
			.cs_parse = &radeon_uvd_cs_parse,
			.ring_test = &r600_uvd_ring_test,
			.ib_test = &r600_uvd_ib_test,
			.is_lockup = &radeon_ring_test_lockup,
			.get_rptr = &radeon_ring_generic_get_rptr,
			.get_wptr = &radeon_ring_generic_get_wptr,
			.set_wptr = &radeon_ring_generic_set_wptr,
		}
	},
	.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,
	},
	.copy = {
		.blit = NULL,
		.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,
	},
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

2617 2618 2619 2620 2621 2622 2623 2624 2625 2626
/**
 * 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 已提交
2627 2628 2629
int radeon_asic_init(struct radeon_device *rdev)
{
	radeon_register_accessor_init(rdev);
2630 2631 2632 2633 2634 2635 2636

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

2637 2638
	rdev->has_uvd = false;

D
Daniel Vetter 已提交
2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665
	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;
2666 2667
		/* handle macs */
		if (rdev->bios == NULL) {
2668 2669 2670 2671
			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;
2672
			rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level;
2673
		}
D
Daniel Vetter 已提交
2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696
		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:
2697 2698
		rdev->asic = &r600_asic;
		break;
D
Daniel Vetter 已提交
2699 2700 2701 2702 2703
	case CHIP_RV610:
	case CHIP_RV630:
	case CHIP_RV620:
	case CHIP_RV635:
	case CHIP_RV670:
2704 2705
		rdev->asic = &rv6xx_asic;
		rdev->has_uvd = true;
2706
		break;
D
Daniel Vetter 已提交
2707 2708
	case CHIP_RS780:
	case CHIP_RS880:
2709
		rdev->asic = &rs780_asic;
2710
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2711 2712 2713 2714 2715 2716
		break;
	case CHIP_RV770:
	case CHIP_RV730:
	case CHIP_RV710:
	case CHIP_RV740:
		rdev->asic = &rv770_asic;
2717
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2718 2719 2720 2721 2722 2723
		break;
	case CHIP_CEDAR:
	case CHIP_REDWOOD:
	case CHIP_JUNIPER:
	case CHIP_CYPRESS:
	case CHIP_HEMLOCK:
2724 2725 2726 2727 2728
		/* set num crtcs */
		if (rdev->family == CHIP_CEDAR)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
D
Daniel Vetter 已提交
2729
		rdev->asic = &evergreen_asic;
2730
		rdev->has_uvd = true;
D
Daniel Vetter 已提交
2731
		break;
2732
	case CHIP_PALM:
2733 2734
	case CHIP_SUMO:
	case CHIP_SUMO2:
2735
		rdev->asic = &sumo_asic;
2736
		rdev->has_uvd = true;
2737
		break;
2738 2739 2740
	case CHIP_BARTS:
	case CHIP_TURKS:
	case CHIP_CAICOS:
2741 2742 2743 2744 2745
		/* set num crtcs */
		if (rdev->family == CHIP_CAICOS)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
2746
		rdev->asic = &btc_asic;
2747
		rdev->has_uvd = true;
2748
		break;
2749 2750
	case CHIP_CAYMAN:
		rdev->asic = &cayman_asic;
2751 2752
		/* set num crtcs */
		rdev->num_crtc = 6;
2753
		rdev->has_uvd = true;
2754
		break;
2755 2756 2757 2758
	case CHIP_ARUBA:
		rdev->asic = &trinity_asic;
		/* set num crtcs */
		rdev->num_crtc = 4;
2759
		rdev->has_uvd = true;
2760
		break;
2761 2762 2763
	case CHIP_TAHITI:
	case CHIP_PITCAIRN:
	case CHIP_VERDE:
2764
	case CHIP_OLAND:
2765
	case CHIP_HAINAN:
2766 2767
		rdev->asic = &si_asic;
		/* set num crtcs */
2768 2769 2770
		if (rdev->family == CHIP_HAINAN)
			rdev->num_crtc = 0;
		else if (rdev->family == CHIP_OLAND)
2771 2772 2773
			rdev->num_crtc = 2;
		else
			rdev->num_crtc = 6;
2774 2775 2776 2777
		if (rdev->family == CHIP_HAINAN)
			rdev->has_uvd = false;
		else
			rdev->has_uvd = true;
2778
		break;
2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791
	case CHIP_BONAIRE:
		rdev->asic = &ci_asic;
		rdev->num_crtc = 6;
		break;
	case CHIP_KAVERI:
	case CHIP_KABINI:
		rdev->asic = &kv_asic;
		/* set num crtcs */
		if (rdev->family == CHIP_KAVERI)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 2;
		break;
D
Daniel Vetter 已提交
2792 2793 2794 2795 2796 2797
	default:
		/* FIXME: not supported yet */
		return -EINVAL;
	}

	if (rdev->flags & RADEON_IS_IGP) {
2798 2799
		rdev->asic->pm.get_memory_clock = NULL;
		rdev->asic->pm.set_memory_clock = NULL;
D
Daniel Vetter 已提交
2800 2801 2802 2803 2804
	}

	return 0;
}