radeon_asic.c 59.5 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
	if (rdev->family >= CHIP_R600) {
D
Daniel Vetter 已提交
126 127 128 129 130 131 132
		rdev->pciep_rreg = &r600_pciep_rreg;
		rdev->pciep_wreg = &r600_pciep_wreg;
	}
}


/* helper to disable agp */
133 134 135 136 137 138 139 140
/**
 * 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 已提交
141 142 143 144 145 146 147 148 149 150 151 152
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;
153 154
		rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush;
		rdev->asic->gart.set_page = &rv370_pcie_gart_set_page;
D
Daniel Vetter 已提交
155 156 157
	} else {
		DRM_INFO("Forcing AGP to PCI mode\n");
		rdev->flags |= RADEON_IS_PCI;
158 159
		rdev->asic->gart.tlb_flush = &r100_pci_gart_tlb_flush;
		rdev->asic->gart.set_page = &r100_pci_gart_set_page;
D
Daniel Vetter 已提交
160 161 162 163 164 165 166
	}
	rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
}

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

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

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,
325
	.asic_reset = &r300_asic_reset,
326 327 328
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
329 330 331 332
	.gart = {
		.tlb_flush = &r100_pci_gart_tlb_flush,
		.set_page = &r100_pci_gart_set_page,
	},
333 334 335 336 337
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
338
			.cs_parse = &r300_cs_parse,
339 340 341
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
342
			.is_lockup = &r100_gpu_is_lockup,
343 344
		}
	},
345 346 347 348
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
349 350 351 352
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
353
		.set_backlight_level = &radeon_legacy_set_backlight_level,
354
		.get_backlight_level = &radeon_legacy_get_backlight_level,
355
	},
356 357 358 359 360 361 362 363
	.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,
	},
364 365 366 367
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
368 369 370 371 372 373
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
374 375 376 377 378 379
	.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,
380 381 382 383 384 385 386
		.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,
387
	},
388 389 390 391 392
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
393 394 395 396 397 398 399 400
};

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,
401
	.asic_reset = &r300_asic_reset,
402 403 404
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
405 406 407 408
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
409 410 411 412 413
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
414
			.cs_parse = &r300_cs_parse,
415 416 417
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
418
			.is_lockup = &r100_gpu_is_lockup,
419 420
		}
	},
421 422 423 424
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
425 426 427 428
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
429
		.set_backlight_level = &radeon_legacy_set_backlight_level,
430
		.get_backlight_level = &radeon_legacy_get_backlight_level,
431
	},
432 433 434 435 436 437 438 439
	.copy = {
		.blit = &r100_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.dma = &r200_copy_dma,
		.dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
		.copy = &r100_copy_blit,
		.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
	},
440 441 442 443
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
444 445 446 447 448 449
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
450 451 452 453 454 455
	.pm = {
		.misc = &r100_pm_misc,
		.prepare = &r100_pm_prepare,
		.finish = &r100_pm_finish,
		.init_profile = &r100_pm_init_profile,
		.get_dynpm_state = &r100_pm_get_dynpm_state,
456 457 458 459 460 461 462
		.get_engine_clock = &radeon_legacy_get_engine_clock,
		.set_engine_clock = &radeon_legacy_set_engine_clock,
		.get_memory_clock = &radeon_legacy_get_memory_clock,
		.set_memory_clock = NULL,
		.get_pcie_lanes = &rv370_get_pcie_lanes,
		.set_pcie_lanes = &rv370_set_pcie_lanes,
		.set_clock_gating = &radeon_legacy_set_clock_gating,
463
	},
464 465 466 467 468
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
469 470 471 472 473 474 475 476
};

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,
477
	.asic_reset = &r300_asic_reset,
478 479 480
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
481 482 483 484
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
485 486 487 488 489
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
490
			.cs_parse = &r300_cs_parse,
491 492 493
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
494
			.is_lockup = &r100_gpu_is_lockup,
495 496
		}
	},
497 498 499 500
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
501 502 503 504
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
505
		.set_backlight_level = &atombios_set_backlight_level,
506
		.get_backlight_level = &atombios_get_backlight_level,
507
	},
508 509 510 511 512 513 514 515
	.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,
	},
516 517 518 519
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
520 521 522 523 524 525
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
526 527 528 529 530 531
	.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,
532 533 534 535 536 537 538
		.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,
539
	},
540 541 542 543 544
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
545 546 547 548 549 550 551 552
};

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,
553
	.asic_reset = &r300_asic_reset,
554 555 556
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs400_mc_wait_for_idle,
557 558 559 560
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
561 562 563 564 565
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
566
			.cs_parse = &r300_cs_parse,
567 568 569
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
570
			.is_lockup = &r100_gpu_is_lockup,
571 572
		}
	},
573 574 575 576
	.irq = {
		.set = &r100_irq_set,
		.process = &r100_irq_process,
	},
577 578 579 580
	.display = {
		.bandwidth_update = &r100_bandwidth_update,
		.get_vblank_counter = &r100_get_vblank_counter,
		.wait_for_vblank = &r100_wait_for_vblank,
581
		.set_backlight_level = &radeon_legacy_set_backlight_level,
582
		.get_backlight_level = &radeon_legacy_get_backlight_level,
583
	},
584 585 586 587 588 589 590 591
	.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,
	},
592 593 594 595
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
596 597 598 599 600 601
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
602 603 604 605 606 607
	.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,
608 609 610 611 612 613 614
		.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,
615
	},
616 617 618 619 620
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
621 622 623 624 625 626 627 628
};

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,
629
	.asic_reset = &rs600_asic_reset,
630 631 632
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs600_mc_wait_for_idle,
633 634 635 636
	.gart = {
		.tlb_flush = &rs600_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
637 638 639 640 641
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
642
			.cs_parse = &r300_cs_parse,
643 644 645
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
646
			.is_lockup = &r100_gpu_is_lockup,
647 648
		}
	},
649 650 651 652
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
653 654 655 656
	.display = {
		.bandwidth_update = &rs600_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
657
		.set_backlight_level = &atombios_set_backlight_level,
658
		.get_backlight_level = &atombios_get_backlight_level,
659
	},
660 661 662 663 664 665 666 667
	.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,
	},
668 669 670 671
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
672 673 674 675 676 677
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
678 679 680 681 682 683
	.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,
684 685 686 687 688 689 690
		.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,
691
	},
692 693 694 695 696
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
697 698 699 700 701 702 703 704
};

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,
705
	.asic_reset = &rs600_asic_reset,
706 707 708
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rs690_mc_wait_for_idle,
709 710 711 712
	.gart = {
		.tlb_flush = &rs400_gart_tlb_flush,
		.set_page = &rs400_gart_set_page,
	},
713 714 715 716 717
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
718
			.cs_parse = &r300_cs_parse,
719 720 721
			.ring_start = &r300_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
722
			.is_lockup = &r100_gpu_is_lockup,
723 724
		}
	},
725 726 727 728
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
729 730 731 732
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rs690_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
733
		.set_backlight_level = &atombios_set_backlight_level,
734
		.get_backlight_level = &atombios_get_backlight_level,
735
	},
736 737 738 739 740 741 742 743
	.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,
	},
744 745 746 747
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
748 749 750 751 752 753
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
754 755 756 757 758 759
	.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,
760 761 762 763 764 765 766
		.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,
767
	},
768 769 770 771 772
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
773 774 775 776 777 778 779 780
};

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,
781
	.asic_reset = &rs600_asic_reset,
782 783 784
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &rv515_mc_wait_for_idle,
785 786 787 788
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
789 790 791 792 793
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
794
			.cs_parse = &r300_cs_parse,
795 796 797
			.ring_start = &rv515_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
798
			.is_lockup = &r100_gpu_is_lockup,
799 800
		}
	},
801 802 803 804
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
805 806 807 808
	.display = {
		.get_vblank_counter = &rs600_get_vblank_counter,
		.bandwidth_update = &rv515_bandwidth_update,
		.wait_for_vblank = &avivo_wait_for_vblank,
809
		.set_backlight_level = &atombios_set_backlight_level,
810
		.get_backlight_level = &atombios_get_backlight_level,
811
	},
812 813 814 815 816 817 818 819
	.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,
	},
820 821 822 823
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
824 825 826 827 828 829
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
830 831 832 833 834 835
	.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,
836 837 838 839 840 841 842
		.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,
843
	},
844 845 846 847 848
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
849 850 851 852 853 854 855 856
};

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,
857
	.asic_reset = &rs600_asic_reset,
858 859 860
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
	.mc_wait_for_idle = &r520_mc_wait_for_idle,
861 862 863 864
	.gart = {
		.tlb_flush = &rv370_pcie_gart_tlb_flush,
		.set_page = &rv370_pcie_gart_set_page,
	},
865 866 867 868 869
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
870
			.cs_parse = &r300_cs_parse,
871 872 873
			.ring_start = &rv515_ring_start,
			.ring_test = &r100_ring_test,
			.ib_test = &r100_ib_test,
874
			.is_lockup = &r100_gpu_is_lockup,
875 876
		}
	},
877 878 879 880
	.irq = {
		.set = &rs600_irq_set,
		.process = &rs600_irq_process,
	},
881 882 883 884
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
885
		.set_backlight_level = &atombios_set_backlight_level,
886
		.get_backlight_level = &atombios_get_backlight_level,
887
	},
888 889 890 891 892 893 894 895
	.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,
	},
896 897 898 899
	.surface = {
		.set_reg = r100_set_surface_reg,
		.clear_reg = r100_clear_surface_reg,
	},
900 901 902 903 904 905
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
906 907 908 909 910 911
	.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,
912 913 914 915 916 917 918
		.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,
919
	},
920 921 922 923 924
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
925 926 927 928 929 930 931 932
};

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,
933
	.asic_reset = &r600_asic_reset,
934 935 936
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
937
	.get_xclk = &r600_get_xclk,
938
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
939 940 941 942
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
943 944 945 946 947
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
948
			.cs_parse = &r600_cs_parse,
949 950
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
951
			.is_lockup = &r600_gfx_is_lockup,
952 953 954 955 956
		},
		[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,
957
			.cs_parse = &r600_dma_cs_parse,
958 959 960
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
961 962
		}
	},
963 964 965 966
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
967 968 969 970
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
971
		.set_backlight_level = &atombios_set_backlight_level,
972
		.get_backlight_level = &atombios_get_backlight_level,
973
	},
974 975 976
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
977 978
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
979 980
		.copy = &r600_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
981
	},
982 983 984 985
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
986 987 988 989 990 991
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
992 993 994 995 996 997
	.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,
998 999 1000 1001 1002 1003 1004
		.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,
1005
	},
1006 1007 1008 1009 1010
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1011 1012
};

1013 1014 1015 1016 1017 1018
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,
1019
	.asic_reset = &r600_asic_reset,
1020 1021 1022
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1023
	.get_xclk = &r600_get_xclk,
1024
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1025 1026 1027 1028
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1029 1030 1031 1032 1033
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1034
			.cs_parse = &r600_cs_parse,
1035 1036
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1037
			.is_lockup = &r600_gfx_is_lockup,
1038 1039 1040 1041 1042
		},
		[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,
1043
			.cs_parse = &r600_dma_cs_parse,
1044 1045 1046
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
1047 1048
		}
	},
1049 1050 1051 1052
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1053 1054 1055 1056
	.display = {
		.bandwidth_update = &rs690_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1057
		.set_backlight_level = &atombios_set_backlight_level,
1058
		.get_backlight_level = &atombios_get_backlight_level,
1059
	},
1060 1061 1062
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1063 1064
		.dma = &r600_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1065 1066
		.copy = &r600_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1067
	},
1068 1069 1070 1071
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1072 1073 1074 1075 1076 1077
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1078 1079 1080 1081 1082 1083
	.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,
1084 1085 1086 1087 1088 1089 1090
		.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,
1091
	},
1092 1093 1094 1095 1096
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1097 1098
};

1099 1100 1101 1102 1103
static struct radeon_asic rv770_asic = {
	.init = &rv770_init,
	.fini = &rv770_fini,
	.suspend = &rv770_suspend,
	.resume = &rv770_resume,
1104
	.asic_reset = &r600_asic_reset,
1105
	.vga_set_state = &r600_vga_set_state,
1106 1107 1108
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
1109
	.get_xclk = &rv770_get_xclk,
1110
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1111 1112 1113 1114
	.gart = {
		.tlb_flush = &r600_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1115 1116 1117 1118 1119
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1120
			.cs_parse = &r600_cs_parse,
1121 1122
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1123
			.is_lockup = &r600_gfx_is_lockup,
1124 1125 1126 1127 1128
		},
		[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,
1129
			.cs_parse = &r600_dma_cs_parse,
1130 1131 1132
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &r600_dma_is_lockup,
C
Christian König 已提交
1133 1134 1135 1136 1137 1138 1139 1140 1141
		},
		[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,
1142 1143
		}
	},
1144 1145 1146 1147
	.irq = {
		.set = &r600_irq_set,
		.process = &r600_irq_process,
	},
1148 1149 1150 1151
	.display = {
		.bandwidth_update = &rv515_bandwidth_update,
		.get_vblank_counter = &rs600_get_vblank_counter,
		.wait_for_vblank = &avivo_wait_for_vblank,
1152
		.set_backlight_level = &atombios_set_backlight_level,
1153
		.get_backlight_level = &atombios_get_backlight_level,
1154
	},
1155 1156 1157
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1158
		.dma = &rv770_copy_dma,
1159
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1160
		.copy = &rv770_copy_dma,
1161
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1162
	},
1163 1164 1165 1166
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1167 1168 1169 1170 1171 1172
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
1173 1174 1175 1176 1177 1178
	.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,
1179 1180 1181 1182 1183 1184 1185
		.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,
1186
		.set_uvd_clocks = &rv770_set_uvd_clocks,
1187
	},
1188 1189 1190 1191 1192
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rv770_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
1193 1194 1195 1196 1197 1198 1199
};

static struct radeon_asic evergreen_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
1200
	.asic_reset = &evergreen_asic_reset,
1201
	.vga_set_state = &r600_vga_set_state,
1202 1203 1204
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1205
	.get_xclk = &rv770_get_xclk,
1206
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1207 1208 1209 1210
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1211 1212 1213 1214 1215
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1216
			.cs_parse = &evergreen_cs_parse,
1217 1218
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1219
			.is_lockup = &evergreen_gfx_is_lockup,
1220 1221 1222 1223 1224
		},
		[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,
1225
			.cs_parse = &evergreen_dma_cs_parse,
1226 1227
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1228
			.is_lockup = &evergreen_dma_is_lockup,
C
Christian König 已提交
1229 1230 1231 1232 1233 1234 1235 1236 1237
		},
		[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,
1238 1239
		}
	},
1240 1241 1242 1243
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1244 1245 1246 1247
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1248
		.set_backlight_level = &atombios_set_backlight_level,
1249
		.get_backlight_level = &atombios_get_backlight_level,
1250
	},
1251 1252 1253
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1254 1255
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1256 1257
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1258
	},
1259 1260 1261 1262
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1263 1264 1265 1266 1267 1268
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1269 1270 1271 1272 1273 1274
	.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,
1275 1276 1277 1278 1279 1280 1281
		.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,
1282
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1283
	},
1284 1285 1286 1287 1288
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1289 1290
};

1291 1292 1293 1294 1295 1296 1297
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,
1298 1299 1300
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1301
	.get_xclk = &r600_get_xclk,
1302
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1303 1304 1305 1306
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1307 1308 1309 1310 1311
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1312
			.cs_parse = &evergreen_cs_parse,
1313 1314
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1315
			.is_lockup = &evergreen_gfx_is_lockup,
1316
		},
1317 1318 1319 1320
		[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,
1321
			.cs_parse = &evergreen_dma_cs_parse,
1322 1323
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1324
			.is_lockup = &evergreen_dma_is_lockup,
C
Christian König 已提交
1325 1326 1327 1328 1329 1330 1331 1332 1333
		},
		[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,
1334
		}
1335
	},
1336 1337 1338 1339
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1340 1341 1342 1343
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1344
		.set_backlight_level = &atombios_set_backlight_level,
1345
		.get_backlight_level = &atombios_get_backlight_level,
1346
	},
1347 1348 1349
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1350 1351
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1352 1353
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1354
	},
1355 1356 1357 1358
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1359 1360 1361 1362 1363 1364
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1365 1366 1367 1368 1369 1370
	.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,
1371 1372 1373 1374 1375 1376 1377
		.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,
1378
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1379
	},
1380 1381 1382 1383 1384
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1385 1386
};

1387 1388 1389 1390 1391 1392 1393
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,
1394 1395 1396
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1397
	.get_xclk = &rv770_get_xclk,
1398
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1399 1400 1401 1402
	.gart = {
		.tlb_flush = &evergreen_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1403 1404 1405 1406 1407
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
1408
			.cs_parse = &evergreen_cs_parse,
1409 1410
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1411
			.is_lockup = &evergreen_gfx_is_lockup,
1412 1413 1414 1415 1416
		},
		[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,
1417
			.cs_parse = &evergreen_dma_cs_parse,
1418 1419
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
1420
			.is_lockup = &evergreen_dma_is_lockup,
C
Christian König 已提交
1421 1422 1423 1424 1425 1426 1427 1428 1429
		},
		[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,
1430 1431
		}
	},
1432 1433 1434 1435
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1436 1437 1438 1439
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1440
		.set_backlight_level = &atombios_set_backlight_level,
1441
		.get_backlight_level = &atombios_get_backlight_level,
1442
	},
1443 1444 1445
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1446 1447
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1448 1449
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1450
	},
1451 1452 1453 1454
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1455 1456 1457 1458 1459 1460
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1461 1462 1463 1464
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1465
		.init_profile = &btc_pm_init_profile,
1466
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1467 1468 1469 1470 1471 1472 1473
		.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,
1474
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1475
	},
1476 1477 1478 1479 1480
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1481 1482
};

1483 1484 1485 1486 1487 1488 1489
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,
1490 1491 1492
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1493
	.get_xclk = &rv770_get_xclk,
1494
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1495 1496 1497 1498
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1499 1500 1501
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1502
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
1503 1504
		.set_page = &cayman_vm_set_page,
	},
1505 1506
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
1507 1508
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1509
			.emit_fence = &cayman_fence_ring_emit,
1510
			.emit_semaphore = &r600_semaphore_ring_emit,
1511
			.cs_parse = &evergreen_cs_parse,
1512 1513
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1514
			.is_lockup = &cayman_gfx_is_lockup,
1515
			.vm_flush = &cayman_vm_flush,
1516 1517
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
1518 1519
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1520
			.emit_fence = &cayman_fence_ring_emit,
1521
			.emit_semaphore = &r600_semaphore_ring_emit,
1522
			.cs_parse = &evergreen_cs_parse,
1523 1524
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1525
			.is_lockup = &cayman_gfx_is_lockup,
1526
			.vm_flush = &cayman_vm_flush,
1527 1528
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
1529 1530
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1531
			.emit_fence = &cayman_fence_ring_emit,
1532
			.emit_semaphore = &r600_semaphore_ring_emit,
1533
			.cs_parse = &evergreen_cs_parse,
1534 1535
			.ring_test = &r600_ring_test,
			.ib_test = &r600_ib_test,
1536
			.is_lockup = &cayman_gfx_is_lockup,
1537
			.vm_flush = &cayman_vm_flush,
1538 1539 1540
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1541
			.ib_parse = &evergreen_dma_ib_parse,
1542 1543
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1544
			.cs_parse = &evergreen_dma_cs_parse,
1545 1546 1547 1548 1549 1550 1551
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1552
			.ib_parse = &evergreen_dma_ib_parse,
1553 1554
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1555
			.cs_parse = &evergreen_dma_cs_parse,
1556 1557 1558 1559
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
C
Christian König 已提交
1560 1561 1562 1563 1564 1565 1566 1567 1568
		},
		[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,
1569 1570
		}
	},
1571 1572 1573 1574
	.irq = {
		.set = &evergreen_irq_set,
		.process = &evergreen_irq_process,
	},
1575 1576 1577 1578
	.display = {
		.bandwidth_update = &evergreen_bandwidth_update,
		.get_vblank_counter = &evergreen_get_vblank_counter,
		.wait_for_vblank = &dce4_wait_for_vblank,
1579
		.set_backlight_level = &atombios_set_backlight_level,
1580
		.get_backlight_level = &atombios_get_backlight_level,
1581
	},
1582 1583 1584
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1585 1586
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1587 1588
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1589
	},
1590 1591 1592 1593
	.surface = {
		.set_reg = r600_set_surface_reg,
		.clear_reg = r600_clear_surface_reg,
	},
1594 1595 1596 1597 1598 1599
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1600 1601 1602 1603
	.pm = {
		.misc = &evergreen_pm_misc,
		.prepare = &evergreen_pm_prepare,
		.finish = &evergreen_pm_finish,
1604
		.init_profile = &btc_pm_init_profile,
1605
		.get_dynpm_state = &r600_pm_get_dynpm_state,
1606 1607 1608 1609 1610 1611 1612
		.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,
1613
		.set_uvd_clocks = &evergreen_set_uvd_clocks,
1614
	},
1615 1616 1617 1618 1619
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1620 1621
};

1622 1623 1624 1625 1626 1627 1628 1629 1630 1631
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,
1632
	.get_xclk = &r600_get_xclk,
1633
	.get_gpu_clock_counter = &r600_get_gpu_clock_counter,
1634 1635 1636 1637
	.gart = {
		.tlb_flush = &cayman_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1638 1639 1640
	.vm = {
		.init = &cayman_vm_init,
		.fini = &cayman_vm_fini,
1641
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
1642 1643
		.set_page = &cayman_vm_set_page,
	},
1644 1645 1646 1647 1648 1649 1650 1651 1652
	.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,
1653
			.is_lockup = &cayman_gfx_is_lockup,
1654
			.vm_flush = &cayman_vm_flush,
1655 1656 1657 1658 1659 1660 1661 1662 1663
		},
		[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,
1664
			.is_lockup = &cayman_gfx_is_lockup,
1665
			.vm_flush = &cayman_vm_flush,
1666 1667 1668 1669 1670 1671 1672 1673 1674
		},
		[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,
1675
			.is_lockup = &cayman_gfx_is_lockup,
1676
			.vm_flush = &cayman_vm_flush,
1677 1678 1679
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1680
			.ib_parse = &evergreen_dma_ib_parse,
1681 1682
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1683
			.cs_parse = &evergreen_dma_cs_parse,
1684 1685 1686 1687 1688 1689 1690
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1691
			.ib_parse = &evergreen_dma_ib_parse,
1692 1693
			.emit_fence = &evergreen_dma_fence_ring_emit,
			.emit_semaphore = &r600_dma_semaphore_ring_emit,
1694
			.cs_parse = &evergreen_dma_cs_parse,
1695 1696 1697 1698
			.ring_test = &r600_dma_ring_test,
			.ib_test = &r600_dma_ib_test,
			.is_lockup = &cayman_dma_is_lockup,
			.vm_flush = &cayman_dma_vm_flush,
C
Christian König 已提交
1699 1700 1701 1702 1703 1704 1705 1706 1707
		},
		[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,
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717
		}
	},
	.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,
1718
		.set_backlight_level = &atombios_set_backlight_level,
1719
		.get_backlight_level = &atombios_get_backlight_level,
1720 1721 1722 1723
	},
	.copy = {
		.blit = &r600_copy_blit,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1724 1725
		.dma = &evergreen_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1726 1727
		.copy = &evergreen_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751
	},
	.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,
1752
		.set_uvd_clocks = &sumo_set_uvd_clocks,
1753 1754 1755 1756 1757 1758 1759 1760
	},
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

1761 1762 1763 1764 1765 1766 1767 1768 1769 1770
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,
1771
	.get_xclk = &si_get_xclk,
1772
	.get_gpu_clock_counter = &si_get_gpu_clock_counter,
1773 1774 1775 1776
	.gart = {
		.tlb_flush = &si_pcie_gart_tlb_flush,
		.set_page = &rs600_gart_set_page,
	},
1777 1778 1779
	.vm = {
		.init = &si_vm_init,
		.fini = &si_vm_fini,
1780
		.pt_ring_index = R600_RING_TYPE_DMA_INDEX,
1781
		.set_page = &si_vm_set_page,
1782
	},
1783 1784 1785 1786 1787 1788 1789 1790 1791
	.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,
1792
			.is_lockup = &si_gfx_is_lockup,
1793
			.vm_flush = &si_vm_flush,
1794 1795 1796 1797 1798 1799 1800 1801 1802
		},
		[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,
1803
			.is_lockup = &si_gfx_is_lockup,
1804
			.vm_flush = &si_vm_flush,
1805 1806 1807 1808 1809 1810 1811 1812 1813
		},
		[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,
1814
			.is_lockup = &si_gfx_is_lockup,
1815
			.vm_flush = &si_vm_flush,
1816 1817 1818
		},
		[R600_RING_TYPE_DMA_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1819
			.ib_parse = &evergreen_dma_ib_parse,
1820 1821 1822 1823 1824
			.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,
1825
			.is_lockup = &si_dma_is_lockup,
1826 1827 1828 1829
			.vm_flush = &si_dma_vm_flush,
		},
		[CAYMAN_RING_TYPE_DMA1_INDEX] = {
			.ib_execute = &cayman_dma_ring_ib_execute,
1830
			.ib_parse = &evergreen_dma_ib_parse,
1831 1832 1833 1834 1835
			.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,
1836
			.is_lockup = &si_dma_is_lockup,
1837
			.vm_flush = &si_dma_vm_flush,
C
Christian König 已提交
1838 1839 1840 1841 1842 1843 1844 1845 1846
		},
		[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,
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856
		}
	},
	.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,
1857
		.set_backlight_level = &atombios_set_backlight_level,
1858
		.get_backlight_level = &atombios_get_backlight_level,
1859 1860 1861 1862
	},
	.copy = {
		.blit = NULL,
		.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1863 1864
		.dma = &si_copy_dma,
		.dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1865 1866
		.copy = &si_copy_dma,
		.copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890
	},
	.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,
1891
		.set_uvd_clocks = &si_set_uvd_clocks,
1892 1893 1894 1895 1896 1897 1898 1899
	},
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
};

1900 1901 1902 1903 1904 1905 1906 1907 1908 1909
/**
 * 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 已提交
1910 1911 1912
int radeon_asic_init(struct radeon_device *rdev)
{
	radeon_register_accessor_init(rdev);
1913 1914 1915 1916 1917 1918 1919

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

D
Daniel Vetter 已提交
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
	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;
1947 1948
		/* handle macs */
		if (rdev->bios == NULL) {
1949 1950 1951 1952
			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;
1953
			rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level;
1954
		}
D
Daniel Vetter 已提交
1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982
		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:
	case CHIP_RV610:
	case CHIP_RV630:
	case CHIP_RV620:
	case CHIP_RV635:
	case CHIP_RV670:
1983 1984
		rdev->asic = &r600_asic;
		break;
D
Daniel Vetter 已提交
1985 1986
	case CHIP_RS780:
	case CHIP_RS880:
1987
		rdev->asic = &rs780_asic;
D
Daniel Vetter 已提交
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999
		break;
	case CHIP_RV770:
	case CHIP_RV730:
	case CHIP_RV710:
	case CHIP_RV740:
		rdev->asic = &rv770_asic;
		break;
	case CHIP_CEDAR:
	case CHIP_REDWOOD:
	case CHIP_JUNIPER:
	case CHIP_CYPRESS:
	case CHIP_HEMLOCK:
2000 2001 2002 2003 2004
		/* set num crtcs */
		if (rdev->family == CHIP_CEDAR)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
D
Daniel Vetter 已提交
2005 2006
		rdev->asic = &evergreen_asic;
		break;
2007
	case CHIP_PALM:
2008 2009
	case CHIP_SUMO:
	case CHIP_SUMO2:
2010 2011
		rdev->asic = &sumo_asic;
		break;
2012 2013 2014
	case CHIP_BARTS:
	case CHIP_TURKS:
	case CHIP_CAICOS:
2015 2016 2017 2018 2019
		/* set num crtcs */
		if (rdev->family == CHIP_CAICOS)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
2020 2021
		rdev->asic = &btc_asic;
		break;
2022 2023
	case CHIP_CAYMAN:
		rdev->asic = &cayman_asic;
2024 2025
		/* set num crtcs */
		rdev->num_crtc = 6;
2026
		break;
2027 2028 2029 2030 2031
	case CHIP_ARUBA:
		rdev->asic = &trinity_asic;
		/* set num crtcs */
		rdev->num_crtc = 4;
		break;
2032 2033 2034
	case CHIP_TAHITI:
	case CHIP_PITCAIRN:
	case CHIP_VERDE:
2035
	case CHIP_OLAND:
2036 2037
		rdev->asic = &si_asic;
		/* set num crtcs */
2038 2039 2040 2041
		if (rdev->family == CHIP_OLAND)
			rdev->num_crtc = 2;
		else
			rdev->num_crtc = 6;
2042
		break;
D
Daniel Vetter 已提交
2043 2044 2045 2046 2047 2048
	default:
		/* FIXME: not supported yet */
		return -EINVAL;
	}

	if (rdev->flags & RADEON_IS_IGP) {
2049 2050
		rdev->asic->pm.get_memory_clock = NULL;
		rdev->asic->pm.set_memory_clock = NULL;
D
Daniel Vetter 已提交
2051 2052 2053 2054 2055
	}

	return 0;
}