radeon_asic.c 38.2 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
/*
 * 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.
 */
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;
}

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);
}

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;
	}
97
	if (rdev->family >= CHIP_R600) {
D
Daniel Vetter 已提交
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
		rdev->pciep_rreg = &r600_pciep_rreg;
		rdev->pciep_wreg = &r600_pciep_wreg;
	}
}


/* helper to disable agp */
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;
		rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush;
		rdev->asic->gart_set_page = &rv370_pcie_gart_set_page;
	} else {
		DRM_INFO("Forcing AGP to PCI mode\n");
		rdev->flags |= RADEON_IS_PCI;
		rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
		rdev->asic->gart_set_page = &r100_pci_gart_set_page;
	}
	rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
}

/*
 * ASIC
 */
131 132 133 134 135 136
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,
137
	.gpu_is_lockup = &r100_gpu_is_lockup,
138
	.asic_reset = &r100_asic_reset,
139 140 141 142
	.gart_tlb_flush = &r100_pci_gart_tlb_flush,
	.gart_set_page = &r100_pci_gart_set_page,
	.ring_start = &r100_ring_start,
	.ring_test = &r100_ring_test,
143 144 145 146 147 148 149
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r100_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r100_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = NULL,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
167 168 169 170 171 172
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
173
	.ioctl_wait_idle = NULL,
174
	.gui_idle = &r100_gui_idle,
175 176 177 178 179 180 181
	.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,
	},
182 183 184 185 186
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
187
	.wait_for_vblank = &r100_wait_for_vblank,
188
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
189 190 191 192 193 194 195 196
};

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,
197
	.gpu_is_lockup = &r100_gpu_is_lockup,
198
	.asic_reset = &r100_asic_reset,
199 200 201 202
	.gart_tlb_flush = &r100_pci_gart_tlb_flush,
	.gart_set_page = &r100_pci_gart_set_page,
	.ring_start = &r100_ring_start,
	.ring_test = &r100_ring_test,
203 204 205 206 207 208 209
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r100_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r100_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_pcie_lanes = NULL,
	.set_clock_gating = &radeon_legacy_set_clock_gating,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
226 227 228 229 230 231
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
232
	.ioctl_wait_idle = NULL,
233
	.gui_idle = &r100_gui_idle,
234 235 236 237 238 239 240
	.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,
	},
241 242 243 244 245
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
246
	.wait_for_vblank = &r100_wait_for_vblank,
247
	.mc_wait_for_idle = &r100_mc_wait_for_idle,
248 249 250 251 252 253 254 255
};

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,
256
	.gpu_is_lockup = &r300_gpu_is_lockup,
257
	.asic_reset = &r300_asic_reset,
258 259 260 261
	.gart_tlb_flush = &r100_pci_gart_tlb_flush,
	.gart_set_page = &r100_pci_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
262 263 264 265 266 267 268
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
286 287 288 289 290 291
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
292
	.ioctl_wait_idle = NULL,
293
	.gui_idle = &r100_gui_idle,
294 295 296 297 298 299 300
	.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,
	},
301 302 303 304 305
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
306
	.wait_for_vblank = &r100_wait_for_vblank,
307
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
308 309 310 311 312 313 314 315
};

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,
316
	.gpu_is_lockup = &r300_gpu_is_lockup,
317
	.asic_reset = &r300_asic_reset,
318 319 320 321
	.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
	.gart_set_page = &rv370_pcie_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
322 323 324 325 326 327 328
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_pcie_lanes = &rv370_set_pcie_lanes,
	.set_clock_gating = &radeon_legacy_set_clock_gating,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
345 346 347 348 349 350
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
351
	.ioctl_wait_idle = NULL,
352
	.gui_idle = &r100_gui_idle,
353 354 355 356 357 358 359
	.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,
	},
360 361 362 363 364
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
365
	.wait_for_vblank = &r100_wait_for_vblank,
366
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
367 368 369 370 371 372 373 374
};

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,
375
	.gpu_is_lockup = &r300_gpu_is_lockup,
376
	.asic_reset = &r300_asic_reset,
377 378 379 380
	.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
	.gart_set_page = &rv370_pcie_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
381 382 383 384 385 386 387
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
405 406 407 408 409 410
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
411
	.ioctl_wait_idle = NULL,
412
	.gui_idle = &r100_gui_idle,
413 414 415 416 417 418 419
	.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,
	},
420 421 422 423 424
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
425
	.wait_for_vblank = &r100_wait_for_vblank,
426
	.mc_wait_for_idle = &r300_mc_wait_for_idle,
427 428 429 430 431 432 433 434
};

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,
435
	.gpu_is_lockup = &r300_gpu_is_lockup,
436
	.asic_reset = &r300_asic_reset,
437 438 439 440
	.gart_tlb_flush = &rs400_gart_tlb_flush,
	.gart_set_page = &rs400_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
441 442 443 444 445 446 447
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
	.irq_set = &r100_irq_set,
	.irq_process = &r100_irq_process,
	.get_vblank_counter = &r100_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &r100_bandwidth_update,
465 466 467 468 469 470
	.hpd = {
		.init = &r100_hpd_init,
		.fini = &r100_hpd_fini,
		.sense = &r100_hpd_sense,
		.set_polarity = &r100_hpd_set_polarity,
	},
471
	.ioctl_wait_idle = NULL,
472
	.gui_idle = &r100_gui_idle,
473 474 475 476 477 478 479
	.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,
	},
480 481 482 483 484
	.pflip = {
		.pre_page_flip = &r100_pre_page_flip,
		.page_flip = &r100_page_flip,
		.post_page_flip = &r100_post_page_flip,
	},
485
	.wait_for_vblank = &r100_wait_for_vblank,
486
	.mc_wait_for_idle = &rs400_mc_wait_for_idle,
487 488 489 490 491 492 493 494
};

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,
495
	.gpu_is_lockup = &r300_gpu_is_lockup,
496
	.asic_reset = &rs600_asic_reset,
497 498 499 500
	.gart_tlb_flush = &rs600_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
501 502 503 504 505 506 507
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
	.irq_set = &rs600_irq_set,
	.irq_process = &rs600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &rs600_bandwidth_update,
525 526 527 528 529 530
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
531
	.ioctl_wait_idle = NULL,
532
	.gui_idle = &r100_gui_idle,
533 534 535 536 537 538 539
	.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,
	},
540 541 542 543 544
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
545
	.wait_for_vblank = &avivo_wait_for_vblank,
546
	.mc_wait_for_idle = &rs600_mc_wait_for_idle,
547 548 549 550 551 552 553 554
};

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,
555
	.gpu_is_lockup = &r300_gpu_is_lockup,
556
	.asic_reset = &rs600_asic_reset,
557 558 559 560
	.gart_tlb_flush = &rs400_gart_tlb_flush,
	.gart_set_page = &rs400_gart_set_page,
	.ring_start = &r300_ring_start,
	.ring_test = &r100_ring_test,
561 562 563 564 565 566 567
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
	.irq_set = &rs600_irq_set,
	.irq_process = &rs600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r200_copy_dma,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &rs690_bandwidth_update,
585 586 587 588 589 590
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
591
	.ioctl_wait_idle = NULL,
592
	.gui_idle = &r100_gui_idle,
593 594 595 596 597 598 599
	.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,
	},
600 601 602 603 604
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
605
	.wait_for_vblank = &avivo_wait_for_vblank,
606
	.mc_wait_for_idle = &rs690_mc_wait_for_idle,
607 608 609 610 611 612 613 614
};

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,
615
	.gpu_is_lockup = &r300_gpu_is_lockup,
616
	.asic_reset = &rs600_asic_reset,
617 618 619 620
	.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
	.gart_set_page = &rv370_pcie_gart_set_page,
	.ring_start = &rv515_ring_start,
	.ring_test = &r100_ring_test,
621 622 623 624 625 626 627
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
	.irq_set = &rs600_irq_set,
	.irq_process = &rs600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &rv515_bandwidth_update,
645 646 647 648 649 650
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
651
	.ioctl_wait_idle = NULL,
652
	.gui_idle = &r100_gui_idle,
653 654 655 656 657 658 659
	.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,
	},
660 661 662 663 664
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
665
	.wait_for_vblank = &avivo_wait_for_vblank,
666
	.mc_wait_for_idle = &rv515_mc_wait_for_idle,
667 668 669 670 671 672 673 674
};

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,
675
	.gpu_is_lockup = &r300_gpu_is_lockup,
676
	.asic_reset = &rs600_asic_reset,
677 678 679 680
	.gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
	.gart_set_page = &rv370_pcie_gart_set_page,
	.ring_start = &rv515_ring_start,
	.ring_test = &r100_ring_test,
681 682 683 684 685 686 687
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r100_ring_ib_execute,
			.emit_fence = &r300_fence_ring_emit,
			.emit_semaphore = &r100_semaphore_ring_emit,
		}
	},
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
	.irq_set = &rs600_irq_set,
	.irq_process = &rs600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r300_cs_parse,
	.copy_blit = &r100_copy_blit,
	.copy_dma = &r200_copy_dma,
	.copy = &r100_copy_blit,
	.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,
	.set_surface_reg = r100_set_surface_reg,
	.clear_surface_reg = r100_clear_surface_reg,
	.bandwidth_update = &rv515_bandwidth_update,
705 706 707 708 709 710
	.hpd = {
		.init = &rs600_hpd_init,
		.fini = &rs600_hpd_fini,
		.sense = &rs600_hpd_sense,
		.set_polarity = &rs600_hpd_set_polarity,
	},
711
	.ioctl_wait_idle = NULL,
712
	.gui_idle = &r100_gui_idle,
713 714 715 716 717 718 719
	.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,
	},
720 721 722 723 724
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
725
	.wait_for_vblank = &avivo_wait_for_vblank,
726
	.mc_wait_for_idle = &r520_mc_wait_for_idle,
727 728 729 730 731 732 733 734
};

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,
735
	.gpu_is_lockup = &r600_gpu_is_lockup,
736
	.asic_reset = &r600_asic_reset,
737 738 739
	.gart_tlb_flush = &r600_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
740 741 742 743 744 745 746
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
747 748 749 750 751
	.irq_set = &r600_irq_set,
	.irq_process = &r600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r600_cs_parse,
	.copy_blit = &r600_copy_blit,
752
	.copy_dma = NULL,
753 754 755 756 757
	.copy = &r600_copy_blit,
	.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,
758 759
	.get_pcie_lanes = &r600_get_pcie_lanes,
	.set_pcie_lanes = &r600_set_pcie_lanes,
760 761 762 763
	.set_clock_gating = NULL,
	.set_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &rv515_bandwidth_update,
764 765 766 767 768 769
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
770
	.ioctl_wait_idle = r600_ioctl_wait_idle,
771
	.gui_idle = &r600_gui_idle,
772 773 774 775 776 777 778
	.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,
	},
779 780 781 782 783
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
784
	.wait_for_vblank = &avivo_wait_for_vblank,
785
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
786 787
};

788 789 790 791 792
static struct radeon_asic rs780_asic = {
	.init = &r600_init,
	.fini = &r600_fini,
	.suspend = &r600_suspend,
	.resume = &r600_resume,
793
	.gpu_is_lockup = &r600_gpu_is_lockup,
794
	.vga_set_state = &r600_vga_set_state,
795
	.asic_reset = &r600_asic_reset,
796 797 798
	.gart_tlb_flush = &r600_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
799 800 801 802 803 804 805
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
806 807 808 809 810
	.irq_set = &r600_irq_set,
	.irq_process = &r600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r600_cs_parse,
	.copy_blit = &r600_copy_blit,
811
	.copy_dma = NULL,
812 813 814 815 816 817 818 819 820 821 822
	.copy = &r600_copy_blit,
	.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,
	.set_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &rs690_bandwidth_update,
823 824 825 826 827 828
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
829
	.ioctl_wait_idle = r600_ioctl_wait_idle,
830
	.gui_idle = &r600_gui_idle,
831 832 833 834 835 836 837
	.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,
	},
838 839 840 841 842
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rs600_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
843
	.wait_for_vblank = &avivo_wait_for_vblank,
844
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
845 846
};

847 848 849 850 851
static struct radeon_asic rv770_asic = {
	.init = &rv770_init,
	.fini = &rv770_fini,
	.suspend = &rv770_suspend,
	.resume = &rv770_resume,
852
	.asic_reset = &r600_asic_reset,
853
	.gpu_is_lockup = &r600_gpu_is_lockup,
854 855 856 857
	.vga_set_state = &r600_vga_set_state,
	.gart_tlb_flush = &r600_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
858 859 860 861 862 863 864
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &r600_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
865 866 867 868 869
	.irq_set = &r600_irq_set,
	.irq_process = &r600_irq_process,
	.get_vblank_counter = &rs600_get_vblank_counter,
	.cs_parse = &r600_cs_parse,
	.copy_blit = &r600_copy_blit,
870
	.copy_dma = NULL,
871 872 873 874 875
	.copy = &r600_copy_blit,
	.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,
876 877
	.get_pcie_lanes = &r600_get_pcie_lanes,
	.set_pcie_lanes = &r600_set_pcie_lanes,
878 879 880 881
	.set_clock_gating = &radeon_atom_set_clock_gating,
	.set_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &rv515_bandwidth_update,
882 883 884 885 886 887
	.hpd = {
		.init = &r600_hpd_init,
		.fini = &r600_hpd_fini,
		.sense = &r600_hpd_sense,
		.set_polarity = &r600_hpd_set_polarity,
	},
888
	.ioctl_wait_idle = r600_ioctl_wait_idle,
889
	.gui_idle = &r600_gui_idle,
890 891 892 893 894 895 896
	.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,
	},
897 898 899 900 901
	.pflip = {
		.pre_page_flip = &rs600_pre_page_flip,
		.page_flip = &rv770_page_flip,
		.post_page_flip = &rs600_post_page_flip,
	},
902
	.wait_for_vblank = &avivo_wait_for_vblank,
903
	.mc_wait_for_idle = &r600_mc_wait_for_idle,
904 905 906 907 908 909 910
};

static struct radeon_asic evergreen_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
911
	.gpu_is_lockup = &evergreen_gpu_is_lockup,
912
	.asic_reset = &evergreen_asic_reset,
913
	.vga_set_state = &r600_vga_set_state,
914
	.gart_tlb_flush = &evergreen_pcie_gart_tlb_flush,
915
	.gart_set_page = &rs600_gart_set_page,
916
	.ring_test = &r600_ring_test,
917 918 919 920 921 922 923
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
924 925 926
	.irq_set = &evergreen_irq_set,
	.irq_process = &evergreen_irq_process,
	.get_vblank_counter = &evergreen_get_vblank_counter,
927
	.cs_parse = &evergreen_cs_parse,
I
Ilija Hadzic 已提交
928
	.copy_blit = &r600_copy_blit,
929
	.copy_dma = NULL,
I
Ilija Hadzic 已提交
930
	.copy = &r600_copy_blit,
931 932 933 934
	.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,
935 936
	.get_pcie_lanes = &r600_get_pcie_lanes,
	.set_pcie_lanes = &r600_set_pcie_lanes,
937 938 939 940
	.set_clock_gating = NULL,
	.set_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &evergreen_bandwidth_update,
941 942 943 944 945 946
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
947
	.ioctl_wait_idle = r600_ioctl_wait_idle,
948
	.gui_idle = &r600_gui_idle,
949 950 951 952 953 954 955
	.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,
	},
956 957 958 959 960
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
961
	.wait_for_vblank = &dce4_wait_for_vblank,
962
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
963 964
};

965 966 967 968 969 970 971 972 973 974 975
static struct radeon_asic sumo_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
	.gpu_is_lockup = &evergreen_gpu_is_lockup,
	.asic_reset = &evergreen_asic_reset,
	.vga_set_state = &r600_vga_set_state,
	.gart_tlb_flush = &evergreen_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
976 977 978 979 980 981 982
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
983 984 985 986
	.irq_set = &evergreen_irq_set,
	.irq_process = &evergreen_irq_process,
	.get_vblank_counter = &evergreen_get_vblank_counter,
	.cs_parse = &evergreen_cs_parse,
I
Ilija Hadzic 已提交
987
	.copy_blit = &r600_copy_blit,
988
	.copy_dma = NULL,
I
Ilija Hadzic 已提交
989
	.copy = &r600_copy_blit,
990 991 992 993 994 995 996 997 998 999
	.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,
	.set_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &evergreen_bandwidth_update,
1000 1001 1002 1003 1004 1005
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1006
	.ioctl_wait_idle = r600_ioctl_wait_idle,
1007
	.gui_idle = &r600_gui_idle,
1008 1009 1010 1011 1012 1013 1014
	.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,
	},
1015 1016 1017 1018 1019
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1020
	.wait_for_vblank = &dce4_wait_for_vblank,
1021
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1022 1023
};

1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
static struct radeon_asic btc_asic = {
	.init = &evergreen_init,
	.fini = &evergreen_fini,
	.suspend = &evergreen_suspend,
	.resume = &evergreen_resume,
	.gpu_is_lockup = &evergreen_gpu_is_lockup,
	.asic_reset = &evergreen_asic_reset,
	.vga_set_state = &r600_vga_set_state,
	.gart_tlb_flush = &evergreen_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
1035 1036 1037 1038 1039 1040 1041
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
			.ib_execute = &evergreen_ring_ib_execute,
			.emit_fence = &r600_fence_ring_emit,
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
1042 1043 1044 1045
	.irq_set = &evergreen_irq_set,
	.irq_process = &evergreen_irq_process,
	.get_vblank_counter = &evergreen_get_vblank_counter,
	.cs_parse = &evergreen_cs_parse,
I
Ilija Hadzic 已提交
1046
	.copy_blit = &r600_copy_blit,
1047
	.copy_dma = NULL,
I
Ilija Hadzic 已提交
1048
	.copy = &r600_copy_blit,
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058
	.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_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &evergreen_bandwidth_update,
1059 1060 1061 1062 1063 1064
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1065
	.ioctl_wait_idle = r600_ioctl_wait_idle,
1066
	.gui_idle = &r600_gui_idle,
1067 1068 1069 1070 1071 1072 1073
	.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,
	},
1074 1075 1076 1077 1078
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1079
	.wait_for_vblank = &dce4_wait_for_vblank,
1080
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1081 1082
};

1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
static const struct radeon_vm_funcs cayman_vm_funcs = {
	.init = &cayman_vm_init,
	.fini = &cayman_vm_fini,
	.bind = &cayman_vm_bind,
	.unbind = &cayman_vm_unbind,
	.tlb_flush = &cayman_vm_tlb_flush,
	.page_flags = &cayman_vm_page_flags,
	.set_page = &cayman_vm_set_page,
};

1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103
static struct radeon_asic cayman_asic = {
	.init = &cayman_init,
	.fini = &cayman_fini,
	.suspend = &cayman_suspend,
	.resume = &cayman_resume,
	.gpu_is_lockup = &cayman_gpu_is_lockup,
	.asic_reset = &cayman_asic_reset,
	.vga_set_state = &r600_vga_set_state,
	.gart_tlb_flush = &cayman_pcie_gart_tlb_flush,
	.gart_set_page = &rs600_gart_set_page,
	.ring_test = &r600_ring_test,
1104 1105
	.ring = {
		[RADEON_RING_TYPE_GFX_INDEX] = {
1106 1107
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1108
			.emit_fence = &cayman_fence_ring_emit,
1109 1110 1111
			.emit_semaphore = &r600_semaphore_ring_emit,
		},
		[CAYMAN_RING_TYPE_CP1_INDEX] = {
1112 1113
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1114
			.emit_fence = &cayman_fence_ring_emit,
1115 1116 1117
			.emit_semaphore = &r600_semaphore_ring_emit,
		},
		[CAYMAN_RING_TYPE_CP2_INDEX] = {
1118 1119
			.ib_execute = &cayman_ring_ib_execute,
			.ib_parse = &evergreen_ib_parse,
1120
			.emit_fence = &cayman_fence_ring_emit,
1121 1122 1123
			.emit_semaphore = &r600_semaphore_ring_emit,
		}
	},
1124 1125 1126 1127
	.irq_set = &evergreen_irq_set,
	.irq_process = &evergreen_irq_process,
	.get_vblank_counter = &evergreen_get_vblank_counter,
	.cs_parse = &evergreen_cs_parse,
I
Ilija Hadzic 已提交
1128
	.copy_blit = &r600_copy_blit,
1129
	.copy_dma = NULL,
I
Ilija Hadzic 已提交
1130
	.copy = &r600_copy_blit,
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140
	.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_surface_reg = r600_set_surface_reg,
	.clear_surface_reg = r600_clear_surface_reg,
	.bandwidth_update = &evergreen_bandwidth_update,
1141 1142 1143 1144 1145 1146
	.hpd = {
		.init = &evergreen_hpd_init,
		.fini = &evergreen_hpd_fini,
		.sense = &evergreen_hpd_sense,
		.set_polarity = &evergreen_hpd_set_polarity,
	},
1147
	.ioctl_wait_idle = r600_ioctl_wait_idle,
1148
	.gui_idle = &r600_gui_idle,
1149 1150 1151 1152 1153 1154 1155
	.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,
	},
1156 1157 1158 1159 1160
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
		.page_flip = &evergreen_page_flip,
		.post_page_flip = &evergreen_post_page_flip,
	},
1161
	.wait_for_vblank = &dce4_wait_for_vblank,
1162
	.mc_wait_for_idle = &evergreen_mc_wait_for_idle,
1163 1164
};

D
Daniel Vetter 已提交
1165 1166 1167
int radeon_asic_init(struct radeon_device *rdev)
{
	radeon_register_accessor_init(rdev);
1168 1169 1170 1171 1172 1173 1174

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

1175 1176 1177
	/* set the ring used for bo copies */
	rdev->copy_ring = RADEON_RING_TYPE_GFX_INDEX;

D
Daniel Vetter 已提交
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
	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;
1205 1206 1207 1208 1209 1210 1211
		/* handle macs */
		if (rdev->bios == NULL) {
			rdev->asic->get_engine_clock = &radeon_legacy_get_engine_clock;
			rdev->asic->set_engine_clock = &radeon_legacy_set_engine_clock;
			rdev->asic->get_memory_clock = &radeon_legacy_get_memory_clock;
			rdev->asic->set_memory_clock = NULL;
		}
D
Daniel Vetter 已提交
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239
		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:
1240 1241
		rdev->asic = &r600_asic;
		break;
D
Daniel Vetter 已提交
1242 1243
	case CHIP_RS780:
	case CHIP_RS880:
1244
		rdev->asic = &rs780_asic;
D
Daniel Vetter 已提交
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
		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:
1257 1258 1259 1260 1261
		/* set num crtcs */
		if (rdev->family == CHIP_CEDAR)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
D
Daniel Vetter 已提交
1262 1263
		rdev->asic = &evergreen_asic;
		break;
1264
	case CHIP_PALM:
1265 1266
	case CHIP_SUMO:
	case CHIP_SUMO2:
1267 1268
		rdev->asic = &sumo_asic;
		break;
1269 1270 1271
	case CHIP_BARTS:
	case CHIP_TURKS:
	case CHIP_CAICOS:
1272 1273 1274 1275 1276
		/* set num crtcs */
		if (rdev->family == CHIP_CAICOS)
			rdev->num_crtc = 4;
		else
			rdev->num_crtc = 6;
1277 1278
		rdev->asic = &btc_asic;
		break;
1279 1280
	case CHIP_CAYMAN:
		rdev->asic = &cayman_asic;
1281 1282
		/* set num crtcs */
		rdev->num_crtc = 6;
1283
		rdev->vm_manager.funcs = &cayman_vm_funcs;
1284
		break;
D
Daniel Vetter 已提交
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
	default:
		/* FIXME: not supported yet */
		return -EINVAL;
	}

	if (rdev->flags & RADEON_IS_IGP) {
		rdev->asic->get_memory_clock = NULL;
		rdev->asic->set_memory_clock = NULL;
	}

	return 0;
}