Lines Matching +full:4 +full:- +full:ring
52 spin_lock_irqsave(&rdev->smc_idx_lock, flags); in tn_smc_rreg()
55 spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); in tn_smc_rreg()
63 spin_lock_irqsave(&rdev->smc_idx_lock, flags); in tn_smc_wreg()
66 spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); in tn_smc_wreg()
439 switch (rdev->family) { in ni_init_golden_registers()
449 if ((rdev->pdev->device == 0x9900) || in ni_init_golden_registers()
450 (rdev->pdev->device == 0x9901) || in ni_init_golden_registers()
451 (rdev->pdev->device == 0x9903) || in ni_init_golden_registers()
452 (rdev->pdev->device == 0x9904) || in ni_init_golden_registers()
453 (rdev->pdev->device == 0x9905) || in ni_init_golden_registers()
454 (rdev->pdev->device == 0x9906) || in ni_init_golden_registers()
455 (rdev->pdev->device == 0x9907) || in ni_init_golden_registers()
456 (rdev->pdev->device == 0x9908) || in ni_init_golden_registers()
457 (rdev->pdev->device == 0x9909) || in ni_init_golden_registers()
458 (rdev->pdev->device == 0x990A) || in ni_init_golden_registers()
459 (rdev->pdev->device == 0x990B) || in ni_init_golden_registers()
460 (rdev->pdev->device == 0x990C) || in ni_init_golden_registers()
461 (rdev->pdev->device == 0x990D) || in ni_init_golden_registers()
462 (rdev->pdev->device == 0x990E) || in ni_init_golden_registers()
463 (rdev->pdev->device == 0x990F) || in ni_init_golden_registers()
464 (rdev->pdev->device == 0x9910) || in ni_init_golden_registers()
465 (rdev->pdev->device == 0x9913) || in ni_init_golden_registers()
466 (rdev->pdev->device == 0x9917) || in ni_init_golden_registers()
467 (rdev->pdev->device == 0x9918)) { in ni_init_golden_registers()
625 if (!rdev->mc_fw) in ni_mc_load_microcode()
626 return -EINVAL; in ni_mc_load_microcode()
628 switch (rdev->family) { in ni_mc_load_microcode()
666 fw_data = (const __be32 *)rdev->mc_fw->data; in ni_mc_load_microcode()
676 for (i = 0; i < rdev->usec_timeout; i++) { in ni_mc_load_microcode()
697 switch (rdev->family) { in ni_init_microcode()
701 pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; in ni_init_microcode()
702 me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; in ni_init_microcode()
703 rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; in ni_init_microcode()
704 mc_req_size = BTC_MC_UCODE_SIZE * 4; in ni_init_microcode()
705 smc_req_size = ALIGN(BARTS_SMC_UCODE_SIZE, 4); in ni_init_microcode()
710 pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; in ni_init_microcode()
711 me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; in ni_init_microcode()
712 rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; in ni_init_microcode()
713 mc_req_size = BTC_MC_UCODE_SIZE * 4; in ni_init_microcode()
714 smc_req_size = ALIGN(TURKS_SMC_UCODE_SIZE, 4); in ni_init_microcode()
719 pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; in ni_init_microcode()
720 me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; in ni_init_microcode()
721 rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; in ni_init_microcode()
722 mc_req_size = BTC_MC_UCODE_SIZE * 4; in ni_init_microcode()
723 smc_req_size = ALIGN(CAICOS_SMC_UCODE_SIZE, 4); in ni_init_microcode()
728 pfp_req_size = CAYMAN_PFP_UCODE_SIZE * 4; in ni_init_microcode()
729 me_req_size = CAYMAN_PM4_UCODE_SIZE * 4; in ni_init_microcode()
730 rlc_req_size = CAYMAN_RLC_UCODE_SIZE * 4; in ni_init_microcode()
731 mc_req_size = CAYMAN_MC_UCODE_SIZE * 4; in ni_init_microcode()
732 smc_req_size = ALIGN(CAYMAN_SMC_UCODE_SIZE, 4); in ni_init_microcode()
738 pfp_req_size = CAYMAN_PFP_UCODE_SIZE * 4; in ni_init_microcode()
739 me_req_size = CAYMAN_PM4_UCODE_SIZE * 4; in ni_init_microcode()
740 rlc_req_size = ARUBA_RLC_UCODE_SIZE * 4; in ni_init_microcode()
750 err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev); in ni_init_microcode()
753 if (rdev->pfp_fw->size != pfp_req_size) { in ni_init_microcode()
755 rdev->pfp_fw->size, fw_name); in ni_init_microcode()
756 err = -EINVAL; in ni_init_microcode()
761 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev); in ni_init_microcode()
764 if (rdev->me_fw->size != me_req_size) { in ni_init_microcode()
766 rdev->me_fw->size, fw_name); in ni_init_microcode()
767 err = -EINVAL; in ni_init_microcode()
771 err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev); in ni_init_microcode()
774 if (rdev->rlc_fw->size != rlc_req_size) { in ni_init_microcode()
776 rdev->rlc_fw->size, fw_name); in ni_init_microcode()
777 err = -EINVAL; in ni_init_microcode()
781 if (!(rdev->flags & RADEON_IS_IGP)) { in ni_init_microcode()
783 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); in ni_init_microcode()
786 if (rdev->mc_fw->size != mc_req_size) { in ni_init_microcode()
788 rdev->mc_fw->size, fw_name); in ni_init_microcode()
789 err = -EINVAL; in ni_init_microcode()
793 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { in ni_init_microcode()
795 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); in ni_init_microcode()
798 release_firmware(rdev->smc_fw); in ni_init_microcode()
799 rdev->smc_fw = NULL; in ni_init_microcode()
801 } else if (rdev->smc_fw->size != smc_req_size) { in ni_init_microcode()
803 rdev->smc_fw->size, fw_name); in ni_init_microcode()
804 err = -EINVAL; in ni_init_microcode()
810 if (err != -EINVAL) in ni_init_microcode()
813 release_firmware(rdev->pfp_fw); in ni_init_microcode()
814 rdev->pfp_fw = NULL; in ni_init_microcode()
815 release_firmware(rdev->me_fw); in ni_init_microcode()
816 rdev->me_fw = NULL; in ni_init_microcode()
817 release_firmware(rdev->rlc_fw); in ni_init_microcode()
818 rdev->rlc_fw = NULL; in ni_init_microcode()
819 release_firmware(rdev->mc_fw); in ni_init_microcode()
820 rdev->mc_fw = NULL; in ni_init_microcode()
826 * cayman_get_allowed_info_register - fetch the register for the info ioctl
832 * Returns 0 for success or -EINVAL for an invalid register
850 return -EINVAL; in cayman_get_allowed_info_register()
857 int actual_temp = (temp / 8) - 49; in tn_get_temp()
878 switch (rdev->family) { in cayman_gpu_init()
880 rdev->config.cayman.max_shader_engines = 2; in cayman_gpu_init()
881 rdev->config.cayman.max_pipes_per_simd = 4; in cayman_gpu_init()
882 rdev->config.cayman.max_tile_pipes = 8; in cayman_gpu_init()
883 rdev->config.cayman.max_simds_per_se = 12; in cayman_gpu_init()
884 rdev->config.cayman.max_backends_per_se = 4; in cayman_gpu_init()
885 rdev->config.cayman.max_texture_channel_caches = 8; in cayman_gpu_init()
886 rdev->config.cayman.max_gprs = 256; in cayman_gpu_init()
887 rdev->config.cayman.max_threads = 256; in cayman_gpu_init()
888 rdev->config.cayman.max_gs_threads = 32; in cayman_gpu_init()
889 rdev->config.cayman.max_stack_entries = 512; in cayman_gpu_init()
890 rdev->config.cayman.sx_num_of_sets = 8; in cayman_gpu_init()
891 rdev->config.cayman.sx_max_export_size = 256; in cayman_gpu_init()
892 rdev->config.cayman.sx_max_export_pos_size = 64; in cayman_gpu_init()
893 rdev->config.cayman.sx_max_export_smx_size = 192; in cayman_gpu_init()
894 rdev->config.cayman.max_hw_contexts = 8; in cayman_gpu_init()
895 rdev->config.cayman.sq_num_cf_insts = 2; in cayman_gpu_init()
897 rdev->config.cayman.sc_prim_fifo_size = 0x100; in cayman_gpu_init()
898 rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; in cayman_gpu_init()
899 rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; in cayman_gpu_init()
904 rdev->config.cayman.max_shader_engines = 1; in cayman_gpu_init()
905 rdev->config.cayman.max_pipes_per_simd = 4; in cayman_gpu_init()
906 rdev->config.cayman.max_tile_pipes = 2; in cayman_gpu_init()
907 if ((rdev->pdev->device == 0x9900) || in cayman_gpu_init()
908 (rdev->pdev->device == 0x9901) || in cayman_gpu_init()
909 (rdev->pdev->device == 0x9905) || in cayman_gpu_init()
910 (rdev->pdev->device == 0x9906) || in cayman_gpu_init()
911 (rdev->pdev->device == 0x9907) || in cayman_gpu_init()
912 (rdev->pdev->device == 0x9908) || in cayman_gpu_init()
913 (rdev->pdev->device == 0x9909) || in cayman_gpu_init()
914 (rdev->pdev->device == 0x990B) || in cayman_gpu_init()
915 (rdev->pdev->device == 0x990C) || in cayman_gpu_init()
916 (rdev->pdev->device == 0x990F) || in cayman_gpu_init()
917 (rdev->pdev->device == 0x9910) || in cayman_gpu_init()
918 (rdev->pdev->device == 0x9917) || in cayman_gpu_init()
919 (rdev->pdev->device == 0x9999) || in cayman_gpu_init()
920 (rdev->pdev->device == 0x999C)) { in cayman_gpu_init()
921 rdev->config.cayman.max_simds_per_se = 6; in cayman_gpu_init()
922 rdev->config.cayman.max_backends_per_se = 2; in cayman_gpu_init()
923 rdev->config.cayman.max_hw_contexts = 8; in cayman_gpu_init()
924 rdev->config.cayman.sx_max_export_size = 256; in cayman_gpu_init()
925 rdev->config.cayman.sx_max_export_pos_size = 64; in cayman_gpu_init()
926 rdev->config.cayman.sx_max_export_smx_size = 192; in cayman_gpu_init()
927 } else if ((rdev->pdev->device == 0x9903) || in cayman_gpu_init()
928 (rdev->pdev->device == 0x9904) || in cayman_gpu_init()
929 (rdev->pdev->device == 0x990A) || in cayman_gpu_init()
930 (rdev->pdev->device == 0x990D) || in cayman_gpu_init()
931 (rdev->pdev->device == 0x990E) || in cayman_gpu_init()
932 (rdev->pdev->device == 0x9913) || in cayman_gpu_init()
933 (rdev->pdev->device == 0x9918) || in cayman_gpu_init()
934 (rdev->pdev->device == 0x999D)) { in cayman_gpu_init()
935 rdev->config.cayman.max_simds_per_se = 4; in cayman_gpu_init()
936 rdev->config.cayman.max_backends_per_se = 2; in cayman_gpu_init()
937 rdev->config.cayman.max_hw_contexts = 8; in cayman_gpu_init()
938 rdev->config.cayman.sx_max_export_size = 256; in cayman_gpu_init()
939 rdev->config.cayman.sx_max_export_pos_size = 64; in cayman_gpu_init()
940 rdev->config.cayman.sx_max_export_smx_size = 192; in cayman_gpu_init()
941 } else if ((rdev->pdev->device == 0x9919) || in cayman_gpu_init()
942 (rdev->pdev->device == 0x9990) || in cayman_gpu_init()
943 (rdev->pdev->device == 0x9991) || in cayman_gpu_init()
944 (rdev->pdev->device == 0x9994) || in cayman_gpu_init()
945 (rdev->pdev->device == 0x9995) || in cayman_gpu_init()
946 (rdev->pdev->device == 0x9996) || in cayman_gpu_init()
947 (rdev->pdev->device == 0x999A) || in cayman_gpu_init()
948 (rdev->pdev->device == 0x99A0)) { in cayman_gpu_init()
949 rdev->config.cayman.max_simds_per_se = 3; in cayman_gpu_init()
950 rdev->config.cayman.max_backends_per_se = 1; in cayman_gpu_init()
951 rdev->config.cayman.max_hw_contexts = 4; in cayman_gpu_init()
952 rdev->config.cayman.sx_max_export_size = 128; in cayman_gpu_init()
953 rdev->config.cayman.sx_max_export_pos_size = 32; in cayman_gpu_init()
954 rdev->config.cayman.sx_max_export_smx_size = 96; in cayman_gpu_init()
956 rdev->config.cayman.max_simds_per_se = 2; in cayman_gpu_init()
957 rdev->config.cayman.max_backends_per_se = 1; in cayman_gpu_init()
958 rdev->config.cayman.max_hw_contexts = 4; in cayman_gpu_init()
959 rdev->config.cayman.sx_max_export_size = 128; in cayman_gpu_init()
960 rdev->config.cayman.sx_max_export_pos_size = 32; in cayman_gpu_init()
961 rdev->config.cayman.sx_max_export_smx_size = 96; in cayman_gpu_init()
963 rdev->config.cayman.max_texture_channel_caches = 2; in cayman_gpu_init()
964 rdev->config.cayman.max_gprs = 256; in cayman_gpu_init()
965 rdev->config.cayman.max_threads = 256; in cayman_gpu_init()
966 rdev->config.cayman.max_gs_threads = 32; in cayman_gpu_init()
967 rdev->config.cayman.max_stack_entries = 512; in cayman_gpu_init()
968 rdev->config.cayman.sx_num_of_sets = 8; in cayman_gpu_init()
969 rdev->config.cayman.sq_num_cf_insts = 2; in cayman_gpu_init()
971 rdev->config.cayman.sc_prim_fifo_size = 0x40; in cayman_gpu_init()
972 rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; in cayman_gpu_init()
973 rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; in cayman_gpu_init()
997 rdev->config.cayman.mem_row_size_in_kb = (4 * (1 << (8 + tmp))) / 1024; in cayman_gpu_init()
998 if (rdev->config.cayman.mem_row_size_in_kb > 4) in cayman_gpu_init()
999 rdev->config.cayman.mem_row_size_in_kb = 4; in cayman_gpu_init()
1001 rdev->config.cayman.shader_engine_tile_size = 32; in cayman_gpu_init()
1002 rdev->config.cayman.num_gpus = 1; in cayman_gpu_init()
1003 rdev->config.cayman.multi_gpu_tile_size = 64; in cayman_gpu_init()
1006 rdev->config.cayman.num_tile_pipes = (1 << tmp); in cayman_gpu_init()
1008 rdev->config.cayman.mem_max_burst_length_bytes = (tmp + 1) * 256; in cayman_gpu_init()
1010 rdev->config.cayman.num_shader_engines = tmp + 1; in cayman_gpu_init()
1012 rdev->config.cayman.num_gpus = tmp + 1; in cayman_gpu_init()
1014 rdev->config.cayman.multi_gpu_tile_size = 1 << tmp; in cayman_gpu_init()
1016 rdev->config.cayman.mem_row_size_in_kb = 1 << tmp; in cayman_gpu_init()
1022 * bits 7:4 num_banks in cayman_gpu_init()
1026 rdev->config.cayman.tile_config = 0; in cayman_gpu_init()
1027 switch (rdev->config.cayman.num_tile_pipes) { in cayman_gpu_init()
1030 rdev->config.cayman.tile_config |= (0 << 0); in cayman_gpu_init()
1033 rdev->config.cayman.tile_config |= (1 << 0); in cayman_gpu_init()
1035 case 4: in cayman_gpu_init()
1036 rdev->config.cayman.tile_config |= (2 << 0); in cayman_gpu_init()
1039 rdev->config.cayman.tile_config |= (3 << 0); in cayman_gpu_init()
1043 /* num banks is 8 on all fusion asics. 0 = 4, 1 = 8, 2 = 16 */ in cayman_gpu_init()
1044 if (rdev->flags & RADEON_IS_IGP) in cayman_gpu_init()
1045 rdev->config.cayman.tile_config |= 1 << 4; in cayman_gpu_init()
1049 rdev->config.cayman.tile_config |= 0 << 4; in cayman_gpu_init()
1052 rdev->config.cayman.tile_config |= 1 << 4; in cayman_gpu_init()
1056 rdev->config.cayman.tile_config |= 2 << 4; in cayman_gpu_init()
1060 rdev->config.cayman.tile_config |= in cayman_gpu_init()
1062 rdev->config.cayman.tile_config |= in cayman_gpu_init()
1066 for (i = (rdev->config.cayman.max_shader_engines - 1); i >= 0; i--) { in cayman_gpu_init()
1072 tmp <<= 4; in cayman_gpu_init()
1078 …for (i = 0; i < (rdev->config.cayman.max_backends_per_se * rdev->config.cayman.max_shader_engines)… in cayman_gpu_init()
1082 …for (i = 0; i < (rdev->config.cayman.max_backends_per_se * rdev->config.cayman.max_shader_engines)… in cayman_gpu_init()
1086 for (i = 0; i < rdev->config.cayman.max_shader_engines; i++) { in cayman_gpu_init()
1092 simd_disable_bitmap |= 0xffffffff << rdev->config.cayman.max_simds_per_se; in cayman_gpu_init()
1096 rdev->config.cayman.active_simds = hweight32(~tmp); in cayman_gpu_init()
1112 if ((rdev->config.cayman.max_backends_per_se == 1) && in cayman_gpu_init()
1113 (rdev->flags & RADEON_IS_IGP)) { in cayman_gpu_init()
1124 rdev->config.cayman.max_backends_per_se * in cayman_gpu_init()
1125 rdev->config.cayman.max_shader_engines, in cayman_gpu_init()
1128 rdev->config.cayman.backend_map = tmp; in cayman_gpu_init()
1132 for (i = 0; i < rdev->config.cayman.max_texture_channel_caches; i++) in cayman_gpu_init()
1154 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.cayman.sx_num_of_sets); in cayman_gpu_init()
1157 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4) | CRC_SIMD_ID_WADDR_DISABLE); in cayman_gpu_init()
1159 /* need to be explicitly zero-ed */ in cayman_gpu_init()
1170 …WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.cayman.sx_max_export_size / 4) - 1… in cayman_gpu_init()
1171 POSITION_BUFFER_SIZE((rdev->config.cayman.sx_max_export_pos_size / 4) - 1) | in cayman_gpu_init()
1172 SMX_BUFFER_SIZE((rdev->config.cayman.sx_max_export_smx_size / 4) - 1))); in cayman_gpu_init()
1174 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.cayman.sc_prim_fifo_size) | in cayman_gpu_init()
1175 SC_HIZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_hiz_tile_fifo_size) | in cayman_gpu_init()
1176 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_earlyz_tile_fifo_size))); in cayman_gpu_init()
1183 WREG32(SQ_MS_FIFO_SIZES, (CACHE_FIFO_SIZE(16 * rdev->config.cayman.sq_num_cf_insts) | in cayman_gpu_init()
1188 WREG32(SQ_GPR_RESOURCE_MGMT_1, NUM_CLAUSE_TEMP_GPRS(4)); in cayman_gpu_init()
1226 if (rdev->family == CHIP_ARUBA) { in cayman_gpu_init()
1244 /* bits 0-7 are the VM contexts0-7 */ in cayman_pcie_gart_tlb_flush()
1252 if (rdev->gart.robj == NULL) { in cayman_pcie_gart_enable()
1253 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n"); in cayman_pcie_gart_enable()
1254 return -EINVAL; in cayman_pcie_gart_enable()
1279 WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); in cayman_pcie_gart_enable()
1280 WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); in cayman_pcie_gart_enable()
1281 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); in cayman_pcie_gart_enable()
1283 (u32)(rdev->dummy_page.addr >> 12)); in cayman_pcie_gart_enable()
1292 /* empty context1-7 */ in cayman_pcie_gart_enable()
1300 rdev->vm_manager.max_pfn - 1); in cayman_pcie_gart_enable()
1302 rdev->vm_manager.saved_table_addr[i]); in cayman_pcie_gart_enable()
1305 /* enable context1-7 */ in cayman_pcie_gart_enable()
1307 (u32)(rdev->dummy_page.addr >> 12)); in cayman_pcie_gart_enable()
1308 WREG32(VM_CONTEXT1_CNTL2, 4); in cayman_pcie_gart_enable()
1310 PAGE_TABLE_BLOCK_SIZE(radeon_vm_block_size - 9) | in cayman_pcie_gart_enable()
1326 (unsigned)(rdev->mc.gtt_size >> 20), in cayman_pcie_gart_enable()
1327 (unsigned long long)rdev->gart.table_addr); in cayman_pcie_gart_enable()
1328 rdev->gart.ready = true; in cayman_pcie_gart_enable()
1337 rdev->vm_manager.saved_table_addr[i] = RREG32( in cayman_pcie_gart_disable()
1367 int ring, u32 cp_int_cntl) in cayman_cp_int_cntl_setup() argument
1369 WREG32(SRBM_GFX_CNTL, RINGID(ring)); in cayman_cp_int_cntl_setup()
1379 struct radeon_ring *ring = &rdev->ring[fence->ring]; in cayman_fence_ring_emit() local
1380 u64 addr = rdev->fence_drv[fence->ring].gpu_addr; in cayman_fence_ring_emit()
1385 radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3)); in cayman_fence_ring_emit()
1386 radeon_ring_write(ring, PACKET3_ENGINE_ME | cp_coher_cntl); in cayman_fence_ring_emit()
1387 radeon_ring_write(ring, 0xFFFFFFFF); in cayman_fence_ring_emit()
1388 radeon_ring_write(ring, 0); in cayman_fence_ring_emit()
1389 radeon_ring_write(ring, 10); /* poll interval */ in cayman_fence_ring_emit()
1390 /* EVENT_WRITE_EOP - flush caches, send int */ in cayman_fence_ring_emit()
1391 radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); in cayman_fence_ring_emit()
1392 radeon_ring_write(ring, EVENT_TYPE(CACHE_FLUSH_AND_INV_EVENT_TS) | EVENT_INDEX(5)); in cayman_fence_ring_emit()
1393 radeon_ring_write(ring, lower_32_bits(addr)); in cayman_fence_ring_emit()
1394 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | DATA_SEL(1) | INT_SEL(2)); in cayman_fence_ring_emit()
1395 radeon_ring_write(ring, fence->seq); in cayman_fence_ring_emit()
1396 radeon_ring_write(ring, 0); in cayman_fence_ring_emit()
1401 struct radeon_ring *ring = &rdev->ring[ib->ring]; in cayman_ring_ib_execute() local
1402 unsigned vm_id = ib->vm ? ib->vm->ids[ib->ring].id : 0; in cayman_ring_ib_execute()
1407 radeon_ring_write(ring, PACKET3(PACKET3_MODE_CONTROL, 0)); in cayman_ring_ib_execute()
1408 radeon_ring_write(ring, 1); in cayman_ring_ib_execute()
1410 if (ring->rptr_save_reg) { in cayman_ring_ib_execute()
1411 uint32_t next_rptr = ring->wptr + 3 + 4 + 8; in cayman_ring_ib_execute()
1412 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); in cayman_ring_ib_execute()
1413 radeon_ring_write(ring, ((ring->rptr_save_reg - in cayman_ring_ib_execute()
1415 radeon_ring_write(ring, next_rptr); in cayman_ring_ib_execute()
1418 radeon_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); in cayman_ring_ib_execute()
1419 radeon_ring_write(ring, in cayman_ring_ib_execute()
1423 (ib->gpu_addr & 0xFFFFFFFC)); in cayman_ring_ib_execute()
1424 radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFF); in cayman_ring_ib_execute()
1425 radeon_ring_write(ring, ib->length_dw | (vm_id << 24)); in cayman_ring_ib_execute()
1428 radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3)); in cayman_ring_ib_execute()
1429 radeon_ring_write(ring, PACKET3_ENGINE_ME | cp_coher_cntl); in cayman_ring_ib_execute()
1430 radeon_ring_write(ring, 0xFFFFFFFF); in cayman_ring_ib_execute()
1431 radeon_ring_write(ring, 0); in cayman_ring_ib_execute()
1432 radeon_ring_write(ring, (vm_id << 24) | 10); /* poll interval */ in cayman_ring_ib_execute()
1440 if (rdev->asic->copy.copy_ring_index == RADEON_RING_TYPE_GFX_INDEX) in cayman_cp_enable()
1441 radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); in cayman_cp_enable()
1444 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; in cayman_cp_enable()
1449 struct radeon_ring *ring) in cayman_gfx_get_rptr() argument
1453 if (rdev->wb.enabled) in cayman_gfx_get_rptr()
1454 rptr = rdev->wb.wb[ring->rptr_offs/4]; in cayman_gfx_get_rptr()
1456 if (ring->idx == RADEON_RING_TYPE_GFX_INDEX) in cayman_gfx_get_rptr()
1458 else if (ring->idx == CAYMAN_RING_TYPE_CP1_INDEX) in cayman_gfx_get_rptr()
1468 struct radeon_ring *ring) in cayman_gfx_get_wptr() argument
1472 if (ring->idx == RADEON_RING_TYPE_GFX_INDEX) in cayman_gfx_get_wptr()
1474 else if (ring->idx == CAYMAN_RING_TYPE_CP1_INDEX) in cayman_gfx_get_wptr()
1483 struct radeon_ring *ring) in cayman_gfx_set_wptr() argument
1485 if (ring->idx == RADEON_RING_TYPE_GFX_INDEX) { in cayman_gfx_set_wptr()
1486 WREG32(CP_RB0_WPTR, ring->wptr); in cayman_gfx_set_wptr()
1488 } else if (ring->idx == CAYMAN_RING_TYPE_CP1_INDEX) { in cayman_gfx_set_wptr()
1489 WREG32(CP_RB1_WPTR, ring->wptr); in cayman_gfx_set_wptr()
1492 WREG32(CP_RB2_WPTR, ring->wptr); in cayman_gfx_set_wptr()
1502 if (!rdev->me_fw || !rdev->pfp_fw) in cayman_cp_load_microcode()
1503 return -EINVAL; in cayman_cp_load_microcode()
1507 fw_data = (const __be32 *)rdev->pfp_fw->data; in cayman_cp_load_microcode()
1513 fw_data = (const __be32 *)rdev->me_fw->data; in cayman_cp_load_microcode()
1526 struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in cayman_cp_start() local
1529 r = radeon_ring_lock(rdev, ring, 7); in cayman_cp_start()
1531 DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); in cayman_cp_start()
1534 radeon_ring_write(ring, PACKET3(PACKET3_ME_INITIALIZE, 5)); in cayman_cp_start()
1535 radeon_ring_write(ring, 0x1); in cayman_cp_start()
1536 radeon_ring_write(ring, 0x0); in cayman_cp_start()
1537 radeon_ring_write(ring, rdev->config.cayman.max_hw_contexts - 1); in cayman_cp_start()
1538 radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); in cayman_cp_start()
1539 radeon_ring_write(ring, 0); in cayman_cp_start()
1540 radeon_ring_write(ring, 0); in cayman_cp_start()
1541 radeon_ring_unlock_commit(rdev, ring, false); in cayman_cp_start()
1545 r = radeon_ring_lock(rdev, ring, cayman_default_size + 19); in cayman_cp_start()
1547 DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); in cayman_cp_start()
1552 radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); in cayman_cp_start()
1553 radeon_ring_write(ring, PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); in cayman_cp_start()
1556 radeon_ring_write(ring, cayman_default_state[i]); in cayman_cp_start()
1558 radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); in cayman_cp_start()
1559 radeon_ring_write(ring, PACKET3_PREAMBLE_END_CLEAR_STATE); in cayman_cp_start()
1562 radeon_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0)); in cayman_cp_start()
1563 radeon_ring_write(ring, 0); in cayman_cp_start()
1566 radeon_ring_write(ring, 0xc0026f00); in cayman_cp_start()
1567 radeon_ring_write(ring, 0x00000000); in cayman_cp_start()
1568 radeon_ring_write(ring, 0x00000000); in cayman_cp_start()
1569 radeon_ring_write(ring, 0x00000000); in cayman_cp_start()
1572 radeon_ring_write(ring, 0xc0036f00); in cayman_cp_start()
1573 radeon_ring_write(ring, 0x00000bc4); in cayman_cp_start()
1574 radeon_ring_write(ring, 0xffffffff); in cayman_cp_start()
1575 radeon_ring_write(ring, 0xffffffff); in cayman_cp_start()
1576 radeon_ring_write(ring, 0xffffffff); in cayman_cp_start()
1578 radeon_ring_write(ring, 0xc0026900); in cayman_cp_start()
1579 radeon_ring_write(ring, 0x00000316); in cayman_cp_start()
1580 radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ in cayman_cp_start()
1581 radeon_ring_write(ring, 0x00000010); /* */ in cayman_cp_start()
1583 radeon_ring_unlock_commit(rdev, ring, false); in cayman_cp_start()
1592 struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in cayman_cp_fini() local
1594 radeon_ring_fini(rdev, ring); in cayman_cp_fini()
1595 radeon_scratch_free(rdev, ring->rptr_save_reg); in cayman_cp_fini()
1635 struct radeon_ring *ring; in cayman_cp_resume() local
1659 WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); in cayman_cp_resume()
1666 /* Set ring buffer size */ in cayman_cp_resume()
1667 ring = &rdev->ring[ridx[i]]; in cayman_cp_resume()
1668 rb_cntl = order_base_2(ring->ring_size / 8); in cayman_cp_resume()
1676 addr = rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET; in cayman_cp_resume()
1683 ring = &rdev->ring[ridx[i]]; in cayman_cp_resume()
1684 WREG32(cp_rb_base[i], ring->gpu_addr >> 8); in cayman_cp_resume()
1688 /* Initialize the ring buffer's read and write pointers */ in cayman_cp_resume()
1689 ring = &rdev->ring[ridx[i]]; in cayman_cp_resume()
1692 ring->wptr = 0; in cayman_cp_resume()
1694 WREG32(cp_rb_wptr[i], ring->wptr); in cayman_cp_resume()
1702 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = true; in cayman_cp_resume()
1703 rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; in cayman_cp_resume()
1704 rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; in cayman_cp_resume()
1706 r = radeon_ring_test(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); in cayman_cp_resume()
1708 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; in cayman_cp_resume()
1709 rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; in cayman_cp_resume()
1710 rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; in cayman_cp_resume()
1714 if (rdev->asic->copy.copy_ring_index == RADEON_RING_TYPE_GFX_INDEX) in cayman_cp_resume()
1715 radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); in cayman_cp_resume()
1807 dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask); in cayman_gpu_soft_reset()
1810 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_ADDR 0x%08X\n", in cayman_gpu_soft_reset()
1812 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_STATUS 0x%08X\n", in cayman_gpu_soft_reset()
1814 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", in cayman_gpu_soft_reset()
1816 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", in cayman_gpu_soft_reset()
1840 dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); in cayman_gpu_soft_reset()
1888 if (!(rdev->flags & RADEON_IS_IGP)) { in cayman_gpu_soft_reset()
1896 dev_info(rdev->dev, "GRBM_SOFT_RESET=0x%08X\n", tmp); in cayman_gpu_soft_reset()
1910 dev_info(rdev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp); in cayman_gpu_soft_reset()
1957 * cayman_gfx_is_lockup - Check if the GFX engine is locked up
1960 * @ring: radeon_ring structure holding ring information
1965 bool cayman_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) in cayman_gfx_is_lockup() argument
1972 radeon_ring_lockup_update(rdev, ring); in cayman_gfx_is_lockup()
1975 return radeon_ring_test_lockup(rdev, ring); in cayman_gfx_is_lockup()
1982 if (!rdev->has_uvd) in cayman_uvd_init()
1987 dev_err(rdev->dev, "failed UVD (%d) init.\n", r); in cayman_uvd_init()
1989 * At this point rdev->uvd.vcpu_bo is NULL which trickles down in cayman_uvd_init()
1994 rdev->has_uvd = false; in cayman_uvd_init()
1997 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_obj = NULL; in cayman_uvd_init()
1998 r600_ring_init(rdev, &rdev->ring[R600_RING_TYPE_UVD_INDEX], 4096); in cayman_uvd_init()
2005 if (!rdev->has_uvd) in cayman_uvd_start()
2010 dev_err(rdev->dev, "failed UVD resume (%d).\n", r); in cayman_uvd_start()
2015 dev_err(rdev->dev, "failed initializing UVD fences (%d).\n", r); in cayman_uvd_start()
2021 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; in cayman_uvd_start()
2026 struct radeon_ring *ring; in cayman_uvd_resume() local
2029 if (!rdev->has_uvd || !rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size) in cayman_uvd_resume()
2032 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; in cayman_uvd_resume()
2033 r = radeon_ring_init(rdev, ring, ring->ring_size, 0, PACKET0(UVD_NO_OP, 0)); in cayman_uvd_resume()
2035 dev_err(rdev->dev, "failed initializing UVD ring (%d).\n", r); in cayman_uvd_resume()
2040 dev_err(rdev->dev, "failed initializing UVD (%d).\n", r); in cayman_uvd_resume()
2050 if (!rdev->has_vce) in cayman_vce_init()
2055 dev_err(rdev->dev, "failed VCE (%d) init.\n", r); in cayman_vce_init()
2057 * At this point rdev->vce.vcpu_bo is NULL which trickles down in cayman_vce_init()
2062 rdev->has_vce = false; in cayman_vce_init()
2065 rdev->ring[TN_RING_TYPE_VCE1_INDEX].ring_obj = NULL; in cayman_vce_init()
2066 r600_ring_init(rdev, &rdev->ring[TN_RING_TYPE_VCE1_INDEX], 4096); in cayman_vce_init()
2067 rdev->ring[TN_RING_TYPE_VCE2_INDEX].ring_obj = NULL; in cayman_vce_init()
2068 r600_ring_init(rdev, &rdev->ring[TN_RING_TYPE_VCE2_INDEX], 4096); in cayman_vce_init()
2075 if (!rdev->has_vce) in cayman_vce_start()
2080 dev_err(rdev->dev, "failed VCE resume (%d).\n", r); in cayman_vce_start()
2085 dev_err(rdev->dev, "failed VCE resume (%d).\n", r); in cayman_vce_start()
2090 dev_err(rdev->dev, "failed initializing VCE1 fences (%d).\n", r); in cayman_vce_start()
2095 dev_err(rdev->dev, "failed initializing VCE2 fences (%d).\n", r); in cayman_vce_start()
2101 rdev->ring[TN_RING_TYPE_VCE1_INDEX].ring_size = 0; in cayman_vce_start()
2102 rdev->ring[TN_RING_TYPE_VCE2_INDEX].ring_size = 0; in cayman_vce_start()
2107 struct radeon_ring *ring; in cayman_vce_resume() local
2110 if (!rdev->has_vce || !rdev->ring[TN_RING_TYPE_VCE1_INDEX].ring_size) in cayman_vce_resume()
2113 ring = &rdev->ring[TN_RING_TYPE_VCE1_INDEX]; in cayman_vce_resume()
2114 r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); in cayman_vce_resume()
2116 dev_err(rdev->dev, "failed initializing VCE1 ring (%d).\n", r); in cayman_vce_resume()
2119 ring = &rdev->ring[TN_RING_TYPE_VCE2_INDEX]; in cayman_vce_resume()
2120 r = radeon_ring_init(rdev, ring, ring->ring_size, 0, 0x0); in cayman_vce_resume()
2122 dev_err(rdev->dev, "failed initializing VCE1 ring (%d).\n", r); in cayman_vce_resume()
2127 dev_err(rdev->dev, "failed initializing VCE (%d).\n", r); in cayman_vce_resume()
2134 struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in cayman_startup() local
2149 if (!(rdev->flags & RADEON_IS_IGP) && !rdev->pm.dpm_enabled) { in cayman_startup()
2163 if (rdev->flags & RADEON_IS_IGP) { in cayman_startup()
2164 rdev->rlc.reg_list = tn_rlc_save_restore_register_list; in cayman_startup()
2165 rdev->rlc.reg_list_size = in cayman_startup()
2167 rdev->rlc.cs_data = cayman_cs_data; in cayman_startup()
2182 dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r); in cayman_startup()
2191 dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r); in cayman_startup()
2197 dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r); in cayman_startup()
2203 dev_err(rdev->dev, "failed initializing DMA fences (%d).\n", r); in cayman_startup()
2209 dev_err(rdev->dev, "failed initializing DMA fences (%d).\n", r); in cayman_startup()
2214 if (!rdev->irq.installed) { in cayman_startup()
2228 r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP_RPTR_OFFSET, in cayman_startup()
2233 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; in cayman_startup()
2234 r = radeon_ring_init(rdev, ring, ring->ring_size, R600_WB_DMA_RPTR_OFFSET, in cayman_startup()
2239 ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX]; in cayman_startup()
2240 r = radeon_ring_init(rdev, ring, ring->ring_size, CAYMAN_WB_DMA1_RPTR_OFFSET, in cayman_startup()
2261 dev_err(rdev->dev, "IB initialization failed (%d).\n", r); in cayman_startup()
2267 dev_err(rdev->dev, "vm manager initialization failed (%d).\n", r); in cayman_startup()
2287 atom_asic_init(rdev->mode_info.atom_context); in cayman_resume()
2292 if (rdev->pm.pm_method == PM_METHOD_DPM) in cayman_resume()
2295 rdev->accel_working = true; in cayman_resume()
2299 rdev->accel_working = false; in cayman_resume()
2312 if (rdev->has_uvd) { in cayman_suspend()
2330 struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in cayman_init() local
2336 return -EINVAL; in cayman_init()
2339 if (!rdev->is_atom_bios) { in cayman_init()
2340 dev_err(rdev->dev, "Expecting atombios for cayman GPU\n"); in cayman_init()
2341 return -EINVAL; in cayman_init()
2349 if (!rdev->bios) { in cayman_init()
2350 dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n"); in cayman_init()
2351 return -EINVAL; in cayman_init()
2354 atom_asic_init(rdev->mode_info.atom_context); in cayman_init()
2375 if (rdev->flags & RADEON_IS_IGP) { in cayman_init()
2376 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { in cayman_init()
2384 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { in cayman_init()
2396 ring->ring_obj = NULL; in cayman_init()
2397 r600_ring_init(rdev, ring, 1024 * 1024); in cayman_init()
2399 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; in cayman_init()
2400 ring->ring_obj = NULL; in cayman_init()
2401 r600_ring_init(rdev, ring, 64 * 1024); in cayman_init()
2403 ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX]; in cayman_init()
2404 ring->ring_obj = NULL; in cayman_init()
2405 r600_ring_init(rdev, ring, 64 * 1024); in cayman_init()
2410 rdev->ih.ring_obj = NULL; in cayman_init()
2417 rdev->accel_working = true; in cayman_init()
2420 dev_err(rdev->dev, "disabling GPU acceleration\n"); in cayman_init()
2424 if (rdev->flags & RADEON_IS_IGP) in cayman_init()
2431 rdev->accel_working = false; in cayman_init()
2441 if (!rdev->mc_fw && !(rdev->flags & RADEON_IS_IGP)) { in cayman_init()
2443 return -EINVAL; in cayman_init()
2455 if (rdev->flags & RADEON_IS_IGP) in cayman_fini()
2463 if (rdev->has_vce) in cayman_fini()
2471 kfree(rdev->bios); in cayman_fini()
2472 rdev->bios = NULL; in cayman_fini()
2481 rdev->vm_manager.nvm = 8; in cayman_vm_init()
2483 if (rdev->flags & RADEON_IS_IGP) { in cayman_vm_init()
2486 rdev->vm_manager.vram_base_offset = tmp; in cayman_vm_init()
2488 rdev->vm_manager.vram_base_offset = 0; in cayman_vm_init()
2497 * cayman_vm_decode_fault - print human readable fault info
2658 * cayman_vm_flush - vm flush using the CP
2661 * using the CP (cayman-si).
2663 void cayman_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, in cayman_vm_flush() argument
2666 radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm_id << 2), 0)); in cayman_vm_flush()
2667 radeon_ring_write(ring, pd_addr >> 12); in cayman_vm_flush()
2670 radeon_ring_write(ring, PACKET0(HDP_MEM_COHERENCY_FLUSH_CNTL, 0)); in cayman_vm_flush()
2671 radeon_ring_write(ring, 0x1); in cayman_vm_flush()
2673 /* bits 0-7 are the VM contexts0-7 */ in cayman_vm_flush()
2674 radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); in cayman_vm_flush()
2675 radeon_ring_write(ring, 1 << vm_id); in cayman_vm_flush()
2678 radeon_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); in cayman_vm_flush()
2679 radeon_ring_write(ring, (WAIT_REG_MEM_FUNCTION(0) | /* always */ in cayman_vm_flush()
2681 radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); in cayman_vm_flush()
2682 radeon_ring_write(ring, 0); in cayman_vm_flush()
2683 radeon_ring_write(ring, 0); /* ref */ in cayman_vm_flush()
2684 radeon_ring_write(ring, 0); /* mask */ in cayman_vm_flush()
2685 radeon_ring_write(ring, 0x20); /* poll interval */ in cayman_vm_flush()
2688 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); in cayman_vm_flush()
2689 radeon_ring_write(ring, 0x0); in cayman_vm_flush()
2708 return -ETIMEDOUT; in tn_set_vce_clocks()
2718 return -ETIMEDOUT; in tn_set_vce_clocks()