	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_r600_dma_ring_test             ## -- Begin function r600_dma_ring_test
	.p2align	4, 0x90
_r600_dma_ring_test:                    ## @r600_dma_ring_test
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	(%rsi), %rax
	movq	_R600_RING_TYPE_DMA_INDEX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.2:
	movq	_R600_WB_DMA_RING_TEST_OFFSET@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_CAYMAN_WB_DMA1_RING_TEST_OFFSET@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %r14d
	movq	16(%r15), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	$-889266515, %r12d              ## imm = 0xCAFEDEAD
	movl	$-889266515, %edi               ## imm = 0xCAFEDEAD
	callq	_cpu_to_le32
	movq	8(%r15), %rcx
	movl	%r14d, %r13d
	shrl	$2, %r13d
	movl	%eax, (%rcx,%r13,4)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_radeon_ring_lock
	movq	%rbx, %rcx
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	movq	(%rcx), %rsi
	leaq	L_.str(%rip), %rdi
	movl	%eax, %edx
	callq	_DRM_ERROR
	jmp	LBB0_12
LBB0_5:
	movl	%r14d, %eax
	addq	%rax, -48(%rbp)                 ## 8-byte Folded Spill
	movq	_DMA_PACKET_WRITE@GOTPCREL(%rip), %rax
	movq	%rcx, %r14
	movl	(%rax), %edi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	xorl	%edx, %edx
	movl	$1, %ecx
	callq	_DMA_PACKET
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_lower_32_bits
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_upper_32_bits
	movzbl	%al, %esi
	movq	%r14, %rdi
	callq	_radeon_ring_write
	movq	%r14, %rdi
	movl	$-559038737, %esi               ## imm = 0xDEADBEEF
	callq	_radeon_ring_write
	movq	%r15, %rdi
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_radeon_ring_unlock_commit
	cmpl	$0, (%r15)
	je	LBB0_11
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	movl	(%rax,%r13,4), %edi
	callq	_le32_to_cpu
	movl	%eax, %r12d
	cmpl	$-559038737, %eax               ## imm = 0xDEADBEEF
	je	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$1, %edi
	callq	_udelay
	incl	%ebx
	movl	(%r15), %eax
	cmpl	%eax, %ebx
	jb	LBB0_6
## %bb.9:
	cmpl	%eax, %ebx
	jae	LBB0_11
LBB0_10:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rsi
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %edx
	callq	_DRM_INFO
	xorl	%ebx, %ebx
	jmp	LBB0_12
LBB0_7:
	movl	(%r15), %eax
	cmpl	%eax, %ebx
	jb	LBB0_10
LBB0_11:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rsi
	leaq	L_.str.2(%rip), %rdi
	movl	%r12d, %edx
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_R600_RING_TYPE_DMA_INDEX,8,3   ## @R600_RING_TYPE_DMA_INDEX
	.comm	_R600_WB_DMA_RING_TEST_OFFSET,4,2 ## @R600_WB_DMA_RING_TEST_OFFSET
	.comm	_CAYMAN_WB_DMA1_RING_TEST_OFFSET,4,2 ## @CAYMAN_WB_DMA1_RING_TEST_OFFSET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"radeon: dma failed to lock ring %d (%d).\n"

	.comm	_DMA_PACKET_WRITE,4,2           ## @DMA_PACKET_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"ring test on %d succeeded in %d usecs\n"

L_.str.2:                               ## @.str.2
	.asciz	"radeon: ring %d test failed (0x%08X)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_r600_dma_ring_test             ; -- Begin function r600_dma_ring_test
	.p2align	2
_r600_dma_ring_test:                    ; @r600_dma_ring_test
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	mov	x21, x0
	mov	w20, #57005
	movk	w20, #51966, lsl #16
	ldr	x8, [x1]
Lloh0:
	adrp	x9, _R600_RING_TYPE_DMA_INDEX@GOTPAGE
Lloh1:
	ldr	x9, [x9, _R600_RING_TYPE_DMA_INDEX@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _R600_WB_DMA_RING_TEST_OFFSET@GOTPAGE
Lloh4:
	ldr	x10, [x10, _R600_WB_DMA_RING_TEST_OFFSET@GOTPAGEOFF]
Lloh5:
	adrp	x11, _CAYMAN_WB_DMA1_RING_TEST_OFFSET@GOTPAGE
Lloh6:
	ldr	x11, [x11, _CAYMAN_WB_DMA1_RING_TEST_OFFSET@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x10, x11, eq
	ldr	w25, [x8]
	ldr	x26, [x0, #16]
	mov	w0, #57005
	movk	w0, #51966, lsl #16
	bl	_cpu_to_le32
	ldr	x8, [x21, #8]
	lsr	w23, w25, #2
	str	w0, [x8, w23, uxtw #2]
	mov	x0, x21
	mov	x1, x19
	mov	w2, #4
	bl	_radeon_ring_lock
	cbz	w0, LBB0_2
; %bb.1:
	mov	x22, x0
	ldr	x1, [x19]
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x22
	bl	_DRM_ERROR
	b	LBB0_10
LBB0_2:
	mov	w24, #48879
	movk	w24, #57005, lsl #16
	add	x22, x26, w25, uxtw
Lloh9:
	adrp	x8, _DMA_PACKET_WRITE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_PACKET_WRITE@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	mov	w1, #0
	mov	w2, #0
	mov	w3, #1
	bl	_DMA_PACKET
	mov	x1, x0
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x22
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x22
	bl	_upper_32_bits
	and	w1, w0, #0xff
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x19
	mov	w1, #48879
	movk	w1, #57005, lsl #16
	bl	_radeon_ring_write
	mov	x0, x21
	mov	x1, x19
	mov	w2, #0
	bl	_radeon_ring_unlock_commit
	ldr	w8, [x21]
	cbz	w8, LBB0_9
; %bb.3:
	mov	w22, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21, #8]
	ldr	w0, [x8, x23, lsl #2]
	bl	_le32_to_cpu
	mov	x20, x0
	cmp	w0, w24
	b.eq	LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #1
	bl	_udelay
	add	w22, w22, #1
	ldr	w8, [x21]
	cmp	w22, w8
	b.lo	LBB0_4
; %bb.6:
	cmp	w22, w8
	b.hs	LBB0_9
LBB0_7:
	ldr	x1, [x19]
Lloh12:
	adrp	x0, l_.str.1@PAGE
Lloh13:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x22
	bl	_DRM_INFO
	mov	w22, #0
	b	LBB0_10
LBB0_8:
	ldr	w8, [x21]
	cmp	w22, w8
	b.lo	LBB0_7
LBB0_9:
	ldr	x1, [x19]
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x20
	bl	_DRM_ERROR
Lloh16:
	adrp	x8, _EINVAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_R600_RING_TYPE_DMA_INDEX,8,3   ; @R600_RING_TYPE_DMA_INDEX
	.comm	_R600_WB_DMA_RING_TEST_OFFSET,4,2 ; @R600_WB_DMA_RING_TEST_OFFSET
	.comm	_CAYMAN_WB_DMA1_RING_TEST_OFFSET,4,2 ; @CAYMAN_WB_DMA1_RING_TEST_OFFSET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"radeon: dma failed to lock ring %d (%d).\n"

	.comm	_DMA_PACKET_WRITE,4,2           ; @DMA_PACKET_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"ring test on %d succeeded in %d usecs\n"

l_.str.2:                               ; @.str.2
	.asciz	"radeon: ring %d test failed (0x%08X)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
