	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kgd_hqd_sdma_destroy
_kgd_hqd_sdma_destroy:                  ## @kgd_hqd_sdma_destroy
	.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
	movl	%edx, %ebx
	movq	%rsi, %r14
	callq	_get_amdgpu_device
	movq	_HZ@GOTPCREL(%rip), %rax
	imull	(%rax), %ebx
	imulq	$274877907, %rbx, %rbx          ## imm = 0x10624DD3
	shrq	$38, %rbx
	movq	_jiffies@GOTPCREL(%rip), %r12
	addl	(%r12), %ebx
	movq	%r14, %rdi
	callq	_get_sdma_mqd
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_get_sdma_base_addr
	movl	%eax, %r15d
	movq	_mmSDMA0_RLC0_RB_CNTL@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	addl	%eax, %edi
	callq	_RREG32
	movq	_SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	notl	%esi
	andl	%eax, %esi
	movl	(%r14), %edi
	addl	%r15d, %edi
	callq	_WREG32
	movq	_mmSDMA0_RLC0_CONTEXT_STATUS@GOTPCREL(%rip), %r13
	movl	%r15d, %edi
	addl	(%r13), %edi
	callq	_RREG32
	movq	_SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK@GOTPCREL(%rip), %r14
	testl	%eax, (%r14)
	jne	LBB0_5
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	movq	%rbx, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$500, %edi                      ## imm = 0x1F4
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_usleep_range
	movl	(%r13), %edi
	addl	%r15d, %edi
	callq	_RREG32
	testl	%eax, (%r14)
	je	LBB0_2
LBB0_5:
	movq	_mmSDMA0_RLC0_DOORBELL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addl	%r15d, %edi
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	_WREG32
	movq	_mmSDMA0_RLC0_RB_CNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	addl	%r15d, %ebx
	movl	%ebx, %edi
	callq	_RREG32
	movq	_SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_WREG32
	movq	_mmSDMA0_RLC0_RB_RPTR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addl	%r15d, %edi
	callq	_RREG32
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	jmp	LBB0_6
LBB0_3:
	movq	_ETIME@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_6:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HZ,4,2                         ## @HZ
	.comm	_jiffies,4,2                    ## @jiffies
	.comm	_mmSDMA0_RLC0_RB_CNTL,4,2       ## @mmSDMA0_RLC0_RB_CNTL
	.comm	_SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK,4,2 ## @SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK
	.comm	_mmSDMA0_RLC0_CONTEXT_STATUS,4,2 ## @mmSDMA0_RLC0_CONTEXT_STATUS
	.comm	_SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK,4,2 ## @SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK
	.comm	_ETIME,4,2                      ## @ETIME
	.comm	_mmSDMA0_RLC0_DOORBELL,4,2      ## @mmSDMA0_RLC0_DOORBELL
	.comm	_mmSDMA0_RLC0_RB_RPTR,4,2       ## @mmSDMA0_RLC0_RB_RPTR
	.no_dead_strip	_kgd_hqd_sdma_destroy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kgd_hqd_sdma_destroy
_kgd_hqd_sdma_destroy:                  ; @kgd_hqd_sdma_destroy
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x2
	mov	x19, x1
	bl	_get_amdgpu_device
Lloh0:
	adrp	x8, _HZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh2:
	ldr	w27, [x8]
Lloh3:
	adrp	x22, _jiffies@GOTPAGE
Lloh4:
	ldr	x22, [x22, _jiffies@GOTPAGEOFF]
	ldr	w26, [x22]
	mov	x0, x19
	bl	_get_sdma_mqd
	mov	x19, x0
	bl	_get_sdma_base_addr
	mov	x20, x0
Lloh5:
	adrp	x23, _mmSDMA0_RLC0_RB_CNTL@GOTPAGE
Lloh6:
	ldr	x23, [x23, _mmSDMA0_RLC0_RB_CNTL@GOTPAGEOFF]
	ldr	w8, [x23]
	add	w0, w8, w0
	bl	_RREG32
Lloh7:
	adrp	x24, _SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK@GOTPAGE
Lloh8:
	ldr	x24, [x24, _SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK@GOTPAGEOFF]
	ldr	w8, [x24]
	bic	w1, w0, w8
	ldr	w8, [x23]
	add	w0, w8, w20
	bl	_WREG32
Lloh9:
	adrp	x25, _mmSDMA0_RLC0_CONTEXT_STATUS@GOTPAGE
Lloh10:
	ldr	x25, [x25, _mmSDMA0_RLC0_CONTEXT_STATUS@GOTPAGEOFF]
	ldr	w8, [x25]
	add	w0, w8, w20
	bl	_RREG32
Lloh11:
	adrp	x28, _SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK@GOTPAGE
Lloh12:
	ldr	x28, [x28, _SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK@GOTPAGEOFF]
	ldr	w8, [x28]
	tst	w8, w0
	b.ne	LBB0_4
; %bb.1:
	mul	w8, w27, w21
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #38
	add	w21, w8, w26
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x22]
	mov	x1, x21
	bl	_time_after
	cbnz	x0, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #500
	mov	w1, #1000
	bl	_usleep_range
	ldr	w8, [x25]
	add	w0, w8, w20
	bl	_RREG32
	ldr	w8, [x28]
	tst	w8, w0
	b.eq	LBB0_2
LBB0_4:
Lloh13:
	adrp	x8, _mmSDMA0_RLC0_DOORBELL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _mmSDMA0_RLC0_DOORBELL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	add	w0, w8, w20
	mov	w1, #0
	bl	_WREG32
	ldr	w8, [x23]
	add	w21, w8, w20
	mov	x0, x21
	bl	_RREG32
	ldr	w8, [x24]
	orr	w1, w8, w0
	mov	x0, x21
	bl	_WREG32
Lloh16:
	adrp	x8, _mmSDMA0_RLC0_RB_RPTR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _mmSDMA0_RLC0_RB_RPTR@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	add	w0, w8, w20
	bl	_RREG32
	mov	x8, x0
	mov	w0, #0
	str	w8, [x19]
	b	LBB0_6
LBB0_5:
Lloh19:
	adrp	x8, _ETIME@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ETIME@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_HZ,4,2                         ; @HZ
	.comm	_jiffies,4,2                    ; @jiffies
	.comm	_mmSDMA0_RLC0_RB_CNTL,4,2       ; @mmSDMA0_RLC0_RB_CNTL
	.comm	_SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK,4,2 ; @SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK
	.comm	_mmSDMA0_RLC0_CONTEXT_STATUS,4,2 ; @mmSDMA0_RLC0_CONTEXT_STATUS
	.comm	_SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK,4,2 ; @SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK
	.comm	_ETIME,4,2                      ; @ETIME
	.comm	_mmSDMA0_RLC0_DOORBELL,4,2      ; @mmSDMA0_RLC0_DOORBELL
	.comm	_mmSDMA0_RLC0_RB_RPTR,4,2       ; @mmSDMA0_RLC0_RB_RPTR
	.no_dead_strip	_kgd_hqd_sdma_destroy
.subsections_via_symbols
